porymap-mcp
v1.0.1MCP server that lets AI agents author Porymap-compatible Pokémon Gen-3 decompilation maps.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
get_project_info Get Project Info
Return a one-shot snapshot of a pokeemerald-family project. Use this as the FIRST call when you start working on an unfamiliar project — it tells you which decomp base the project targets, how many maps and tilesets it contains, and the absolute paths to the three index files you may want to inspect with other tools.
| Parameter | Type | Description |
|---|---|---|
project_path * | string | Filesystem path to the project root (the directory that contains porymap.project.cfg). Accepts absolute paths, ~-prefixed paths, and paths relative to the server's cwd. |
list_maps List Maps
List every map registered in data/maps/map_groups.json. Use this to translate a fuzzy user request like "edit Littleroot" into a canonical MAP_LITTLEROOT_TOWN identifier before calling map-specific tools. Maps are returned in the project's canonical group order (matching what Porymap shows in its sidebar).
| Parameter | Type | Description |
|---|---|---|
project_path * | string | project root. |
get_map_info Get Map Info
Return full metadata for a single map. Call this immediately before any map-mutation tool. It gives the map's dimensions (needed to validate (x, y) for paint_*), its tilesets (needed to decide which metatile ids are valid), and counts of every event class. Coordinates inside the map are (x, y) with origin top-left and 0 <= x < width, 0 <= y < height.
| Parameter | Type | Description |
|---|---|---|
map_name * | string | map constant, e.g. "MAP_LITTLEROOT_TOWN". Get the valid set with list_maps. |
project_path * | string | project root. |
list_tilesets List Tilesets
List every tileset discovered on disk (primary + secondary). The agent uses this to pick a primary_tileset / secondary_tileset pair when calling create_map, or to look up a tileset's metatile count before list_metatiles. Treat c_label_unverified=true as "probably right, but cross-check with layouts.json".
| Parameter | Type | Description |
|---|---|---|
project_path * | string | project root. |
list_metatiles List Metatiles
List the metatiles in a single tileset. Returns one entry per metatile id with its decoded attributes. Does NOT return rendered images; that's a Phase 4 (L3) capability. In v0.1.0 prerelease ``metatiles`` is empty and ``metatile_count`` is file-size-derived; per-metatile attributes land with parsers/metatiles.py.
| Parameter | Type | Description |
|---|---|---|
project_path * | string | project root. |
tileset_name * | string | directory basename (NOT C label). Example: "general", not "gTileset_General". Get the valid set with list_tilesets. |
list_prefabs List Prefabs
List named metatile-stamp prefabs available to paint_prefab. In v0.1.0 no prefabs ship; this tool returns ``{"prefabs": []}`` so paint_prefab has a discovery pair from day one.
| Parameter | Type | Description |
|---|---|---|
project_path * | string | project root. |
list_events List Events
List every event on a map, grouped by class. Returns object_events, warp_events, coord_events, and bg_events. Each event carries a synthesized "_event_id" of the form "<class>:<index>" usable with remove_event. IDs shift across mutations — call list_events again after any change.
| Parameter | Type | Description |
|---|---|---|
map_name * | string | map constant. Get from list_maps. |
project_path * | string | project root. |
paint_metatile Paint Metatile
Set a single tile on a map's layout. The atomic paint primitive. Idempotent: re-running with identical args does NOT rewrite the file (mtime stable). Coordinates are (x, y), origin top-left.
| Parameter | Type | Description |
|---|---|---|
map_name * | string | MAP_* constant. Get from list_maps. |
metatile_id * | integer | 0..1023. Use list_metatiles for valid ids. |
project_path * | string | project root. |
x * | integer | |
y * | integer | |
collision | 0..3, or None to preserve. | |
elevation | 0..15, or None to preserve. | |
return_render | boolean | if True, the response also carries a PNG render of the post-mutation map (default False to keep the response small). |
paint_rectangle Paint Rectangle
Fill an axis-aligned inclusive rectangle with one metatile id. Both corners painted. Strict order: x1<=x2 and y1<=y2 (reversed raises rather than auto-swapping). Idempotent.
| Parameter | Type | Description |
|---|---|---|
map_name * | string | MAP_* constant. |
metatile_id * | integer | 0..1023. |
project_path * | string | project root. |
x1 * | integer | |
x2 * | integer | |
y1 * | integer | |
y2 * | integer | |
collision | 0..3, or None to preserve each tile's value. | |
elevation | 0..15, or None to preserve. | |
return_render | boolean | if True, attach a PNG render of the post-mutation map to the response. |
flood_fill Flood Fill
Replace a 4-connected region of identical metatiles with a new id. Matches against metatile_id only (collision/elevation not consulted for matching). 4-connected (N/S/E/W), iterative BFS.
| Parameter | Type | Description |
|---|---|---|
map_name * | string | MAP_* constant. |
metatile_id * | integer | replacement value. |
project_path * | string | project root. |
x * | integer | |
y * | integer | |
collision | 0..3, or None to preserve per-tile. | |
elevation | 0..15, or None to preserve. | |
return_render | boolean | if True, attach a PNG render of the post-mutation map to the response. |
set_border Set Border
Replace a map's repeating border tiles. metatile_ids is a 2-D list [row][col] of size border_height x border_width (read via get_map_info). Idempotent.
| Parameter | Type | Description |
|---|---|---|
map_name * | string | MAP_* constant. |
metatile_ids * | array | 2-D grid of metatile ids matching the layout's declared border dimensions. |
project_path * | string | project root. |
collision_ids | optional 2-D grid of 0..3, or None to preserve. | |
elevation_ids | optional 2-D grid of 0..15, or None to preserve. | |
return_render | boolean | if True, attach a PNG render of the post-mutation map to the response. |
create_map Create Map
Create a new map: writes 5 files and registers it everywhere. Naming is derived from `name` (bare PascalCase, e.g. "LittlerootTown"): MAP_LITTLEROOT_TOWN, LAYOUT_LITTLEROOT_TOWN, data/maps/LittlerootTown/, data/layouts/LittlerootTown/. DO NOT pass MAP_* or LAYOUT_* directly. Group is created if missing. Duplicate names raise. include/constants/map_groups.h is NOT touched (pret build scripts regenerate it).
| Parameter | Type | Description |
|---|---|---|
group * | string | C symbol, e.g. "gMapGroup_TownsAndRoutes". |
height * | integer | |
name * | string | bare PascalCase. |
primary_tileset * | string | |
project_path * | string | project root. |
secondary_tileset * | string | |
width * | integer | |
border_metatile_ids | optional 2-D border grid (default 2x2). | |
fill_metatile_id | integer | initial fill for layout + border (collision=0, elevation=0). Default 0. |
header_overrides | dict of map.json header keys to override on top of the minimal defaults (MUS_NONE, WEATHER_NONE, etc.). | |
return_render | boolean |
resize_map Resize Map
Resize a map's layout, preserving overlapping content. Existing content anchored at (0, 0); new cells filled with fill_metatile_id. Shrinking that would orphan any event is REFUSED with an error listing the events — call remove_event first. Only anchor="top-left" supported in v0.1.0.
| Parameter | Type | Description |
|---|---|---|
map_name * | string | MAP_* constant. |
new_height * | integer | |
new_width * | integer | |
project_path * | string | project root. |
anchor | string | "top-left" only for now. |
fill_metatile_id | integer | 0..1023; value for newly-exposed cells. |
return_render | boolean |
paint_prefab Paint Prefab
Stamp a named prefab at (x, y) (top-left anchor). Lists available prefabs via list_prefabs. Tileset compatibility is enforced: if the prefab declares required primary/secondary tilesets, the target map's layout must match. No auto-import.
| Parameter | Type | Description |
|---|---|---|
map_name * | string | MAP_* constant. |
prefab_name * | string | built-in prefab name (e.g. "house_small"). |
project_path * | string | project root. |
x * | integer | |
y * | integer | |
return_render | boolean |
register_map Register Map
Register an existing on-disk map directory in map_groups.json. Repair tool. Use when a map's files exist on disk (data/maps/<bare>/map.json + data/layouts/<bare>/) but it is not listed in any group. Scans every map.json on disk to locate the map (does NOT require it to already be registered).
| Parameter | Type | Description |
|---|---|---|
group * | string | C symbol for the map group. |
map_name * | string | MAP_* constant. |
project_path * | string | project root. |
unregister_map Unregister Map
Remove a map from map_groups.json. Does NOT delete files. The map's data/maps/<bare>/ and data/layouts/<bare>/ directories are left in place. Idempotent: a map already absent from every group is a no-op success. If unregistering empties the group, the group itself is also removed.
| Parameter | Type | Description |
|---|---|---|
map_name * | string | MAP_* constant. |
project_path * | string | project root. |
add_warp Add Warp
Append a warp event to a map. A warp teleports the player to dest_map's dest_warp_id (the destination warp's index, 0-based, in its own warp_events array).
| Parameter | Type | Description |
|---|---|---|
dest_map * | string | MAP_* constant of the DESTINATION map. |
dest_warp_id * | integer | 0-based index into dest_map's warp_events array. |
map_name * | string | MAP_* constant of the SOURCE map (where the warp lives). |
project_path * | string | project root. |
x * | integer | |
y * | integer | |
elevation | integer | 0..15. Default 0. |
return_render | boolean | if True, attach a PNG render of the post-mutation map to the response. |
add_object_event Add Object Event
Append an object event (NPC, item ball, static) to a map. Does NOT generate a script stub — too varied for boilerplate. The caller is responsible for authoring the referenced script symbol elsewhere (or leaving script="" for a non-interactive NPC).
| Parameter | Type | Description |
|---|---|---|
graphics_id * | string | OBJ_EVENT_GFX_* constant (e.g. "OBJ_EVENT_GFX_MOM"). |
map_name * | string | MAP_* constant. |
project_path * | string | project root. |
x * | integer | |
y * | integer | |
elevation | integer | 0..15. Default 3. |
flag | string | flag controlling visibility (e.g. "FLAG_HIDE_X"), "0" for none. |
movement_range_x | integer | |
movement_range_y | integer | |
movement_type | string | MOVEMENT_TYPE_* constant. Default static. |
return_render | boolean | |
script | string | script symbol name (e.g. "LittlerootTown_EventScript_Mom"), or "" for none. |
trainer_sight_or_berry_tree_id | string | |
trainer_type | string |
add_sign Add Sign
Append a sign with inline text. Generates a script stub. Writes a poryscript stub by default (use_poryscript=1) or a legacy .inc stub. Script symbol: <bare>_EventScript_Sign_<N> where <N> is the next free index for this map. The script file is created if missing; the stub is appended.
| Parameter | Type | Description |
|---|---|---|
map_name * | string | MAP_* constant. |
project_path * | string | project root. |
text * | string | the message displayed when the sign is read. |
x * | integer | |
y * | integer | |
elevation | integer | 0..15. Default 0. |
player_facing_dir | string | BG_EVENT_PLAYER_FACING_* constant. |
return_render | boolean | if True, attach a PNG render of the post-mutation map to the response. |
add_trigger Add Trigger
Append a coord-based script trigger. Fires the script when the player steps on (x, y) AND var equals value. Does NOT generate a script stub; the caller authors the referenced symbol elsewhere.
| Parameter | Type | Description |
|---|---|---|
map_name * | string | MAP_* constant. |
project_path * | string | project root. |
script * | string | script symbol to run. |
value * | integer | integer compared against var. |
var * | string | VAR_* constant controlling fire condition. |
x * | integer | |
y * | integer | |
elevation | integer | 0..15. Default 0. |
return_render | boolean | if True, attach a PNG render of the post-mutation map to the response. |
remove_event Remove Event
Remove any event by its synthesized _event_id. Get the id from list_events. Format: "<class>:<index>" (e.g. "warp_events:1"). Ids shift across mutations — call list_events again after any add_*/remove_event. Idempotent: removing an already-absent id is a no-op success. Script files are NOT deleted; if you removed a sign, its stub stays in data/maps/<bare>/scripts.pory (or .inc).
| Parameter | Type | Description |
|---|---|---|
event_id * | string | e.g. "warp_events:1". |
map_name * | string | MAP_* constant. |
project_path * | string | project root. |
return_render | boolean |
render_map Render Map
Render a map's full layout as a PNG image. Returns the rendered PNG as an MCP image content block plus a structured metadata dict (dimensions, encoding, byte size). Use this as the canonical "let me see what I just painted" tool after any layout mutation.
| Parameter | Type | Description |
|---|---|---|
map_name * | string | MAP_* constant. Get from list_maps. |
project_path * | string | project root. |
include_border | boolean | render the wrap-around border frame (7 metatiles per side, Porymap default). Default False. |
overlays | subset of {"collision", "elevation", "grid", "events"}. Drawn alpha-blended on top of the base render, in order. Forces RGBA PNG output. Default [] (none). | |
scale | integer | integer up-scale factor (1..8), nearest-neighbor. Default 1. |
render_map_region Render Map Region
Render a half-open rectangular slice of a map to PNG. Coordinates are in metatile units with the top-left origin Porymap uses; the rectangle is half-open [x1, x2) x [y1, y2). Useful for inspecting a single town inside a large region map, or the patch you just edited inside a 60x120 layout without spending the full render.
| Parameter | Type | Description |
|---|---|---|
map_name * | string | MAP_* constant. |
project_path * | string | project root. |
x1 * | integer | |
x2 * | integer | |
y1 * | integer | |
y2 * | integer | |
overlays | subset of {"collision", "elevation", "grid", "events"}. Same semantics as render_map; clipped to the region. Events outside the region are silently dropped. Forces RGBA output. | |
scale | integer | integer up-scale factor (1..8). |
render_metatile Render Metatile
Render a single metatile from a tileset as a PNG. The metatile is composed using the requested tileset paired with the first opposite-kind tileset in the project (primary <-> secondary). This matters only for metatiles that reference the companion's tiles or palettes; same-tileset references render identically regardless of pairing.
| Parameter | Type | Description |
|---|---|---|
metatile_id * | integer | 0..1023. |
project_path * | string | project root. |
tileset_name * | string | directory basename (NOT C label). Get from list_tilesets. |
scale | integer | integer up-scale factor (1..8). Default 4 (yields a 64x64 preview, comfortable to inspect visually). |