Skip to main content
Glama

tilemap_manage

Set, fill, erase, and inspect tilemap cells, and generate full layouts directly in the Godot editor, with undoable operations for fast level design.

Instructions

TileMap / TileMapLayer authoring (set tiles, fill rects, clear, read cells, generate layouts).

CRITICAL DIRECTIVE: ALWAYS place tiles directly down into the TileMap or TileMapLayer node in the active editor scene using this tool. NEVER generate maps by writing procedural GDScript code in _ready() unless the user explicitly requested runtime procedural generation. Direct tile placement enables visual editing, native Godot physics, and instant editor inspection.

All operations target TileMapLayer or TileMap nodes in the currently edited scene by scene-relative path (e.g. "/LavaLake20x20/Ground"). All write ops are undoable via EditorUndoRedoManager.

source_id is the TileSet source index. atlas_col/atlas_row are the atlas coordinates of the tile within that source. For full-tile animated sources (lava, water, sewage) use atlas_col=0, atlas_row=0.

IMPORTANT — Source-ID remapping in specialized .tres files: When a layer uses a specialized .tres (e.g. volcano_animated.tres), Source-IDs are re-numbered from 0. Example: volcano lava is Source 8 in the main volcano.tres but Source 0 in volcano_animated.tres. Always use the remapped ID when the TileMapLayer references a specialized .tres, not the original ID from the main .tres.

Ops: • tilemap_set_cell(path, source_id, atlas_col, atlas_row, map_x, map_y) Set a single tile at (map_x, map_y). Returns: {map_x, map_y, source_id, atlas_col, atlas_row}

• tilemap_set_cells_rect(path, source_id, atlas_col, atlas_row, rect_x, rect_y, rect_w, rect_h) Fill a rect_w × rect_h region starting at (rect_x, rect_y) with one tile type in a single undo action. Returns: {cells_filled, rect: {x, y, w, h}}

• tilemap_clear(path) Remove all tiles from the layer. Returns: {cleared: true}

• tilemap_get_cells(path) Return all used cell coordinates. Returns: {cells: [{x, y}, ...], count: int}

• tilemap_place_tile(path, source_id, atlas_col, atlas_row, map_x, map_y, rotation_degrees=0, flip_h=false, flip_v=false, alternative_tile=-1) Place a tile with exact rotation (0, 90, 180, 270) and flip flags. Returns: {map_x, map_y, source_id, atlas_col, atlas_row, alternative_tile, rotation_degrees, flip_h, flip_v}

• tilemap_rotate_cell(path, map_x, map_y, degrees=90) Rotate an existing tile cell at (map_x, map_y) clockwise by degrees (90, 180, 270) with D4 symmetry. Returns: {map_x, map_y, degrees, old_alternative, new_alternative}

• tilemap_flip_cell(path, map_x, map_y, flip_h=false, flip_v=false) Flip an existing tile cell at (map_x, map_y) horizontally and/or vertically. Returns: {map_x, map_y, flip_h_applied, flip_v_applied, new_alternative}

• tilemap_erase_cell(path, map_x, map_y) Erase a single tile cell at (map_x, map_y). Returns: {map_x, map_y, erased}

• tilemap_get_cell(path, map_x, map_y) Get detailed information of a tile cell. Returns: {has_tile, map_x, map_y, source_id, atlas_col, atlas_row, alternative_tile, flip_h, flip_v, transpose}

• tilemap_generate_layout(path, genre="platformer", rect_w=32, rect_h=18, rect_x=0, rect_y=0, source_id=0, floor_col=0, floor_row=0, wall_col=1, wall_row=0, accent_col=2, accent_row=0, layer=0) Generate a complete layout placed directly into the editor. Supported genres: 'platformer', 'topdown', 'rpg', 'dungeon', 'arena'. Returns: {genre, cells_placed, rect, source_id, layer, undoable}

Canonical call shape: {"op": "<verb>", "params": {...}}. Flat op parameters are accepted as a compatibility alias when the client transmits them; op and session_id remain top-level.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
opYes
paramsNo
session_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv5.0.9
    • changedInput schema / properties / op / enum
      Previous value: -[
      -  "tilemap_clear",
      -  "tilemap_erase_cell",
      -  "tilemap_flip_cell",
      -  "tilemap_get_cell",
      -  "tilemap_get_cells",
      -  "tilemap_place_tile",
      -  "tilemap_rotate_cell",
      -  "tilemap_set_cell",
      -  "tilemap_set_cells_rect"
      -]New value: +[
      +  "clear",
      +  "erase_cell",
      +  "flip_cell",
      +  "generate_layout",
      +  "get_cell",
      +  "get_cells",
      +  "place_tile",
      +  "rotate_cell",
      +  "set_cell",
      +  "set_cells_rect",
      +  "tilemap_clear",
      +  "tilemap_erase_cell",
      +  "tilemap_flip_cell",
      +  "tilemap_generate_layout",
      +  "tilemap_get_cell",
      +  "tilemap_get_cells",
      +  "tilemap_place_tile",
      +  "tilemap_rotate_cell",
      +  "tilemap_set_cell",
      +  "tilemap_set_cells_rect"
      +]
  2. First observedv4.1.0

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden, and it delivers substantial behavioral context: all ops target the currently edited scene by scene-relative path, all writes are undoable via EditorUndoRedoManager, and the source-ID remapping gotcha in specialized .tres files is explicitly flagged. It stops short of covering failure modes (invalid paths, non-editor contexts), which keeps it from a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well front-loaded: purpose, critical directive, shared semantics, per-op reference, then call shape. The content density justifies most of the length for a 20-value dispatcher with zero schema coverage, though the all-caps directive is somewhat repetitive and the op bullet list could be tightened without losing information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool this complex — 11 sub-operations, per-op return shapes, a remapping gotcha — the description is remarkably complete: paths, undo behavior, remapping, signatures, defaults, and response fields. Remaining gaps are minor but real: some generate_layout parameters (floor/wall/accent columns, layer) are left to inference, alternative_tile semantics are unexplained, and error behavior is not addressed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% and the schema is a bare dispatcher (op enum + opaque params object), so the description must do all the work — and it does. It explains source_id/atlas_col/atlas_row semantics, documents every op signature with defaults, and clarifies the canonical {op, params} call shape versus the flat alias, fully compensating for the empty schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb+resource: 'TileMap / TileMapLayer authoring (set tiles, fill rects, clear, read cells, generate layouts).' The eleven enumerated sub-operations make the scope unmistakable, and the TileMap/TileMapLayer focus cleanly distinguishes it from siblings like tileset_manage and gridmap_manage.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The CRITICAL DIRECTIVE gives explicit when/when-not guidance: ALWAYS place tiles through this tool, NEVER via procedural GDScript in _ready() unless the user explicitly requested runtime generation. It even justifies the choice (visual editing, native physics, editor inspection), so an agent can apply the rule rather than merely memorize it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.