Skip to main content
Glama

tilemap_manage

Edit Godot TileMap layers directly in the editor: place, fill, clear, rotate, flip, and generate layouts with undo support.

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 tile cell at (map_x, map_y) clockwise by degrees (90, 180, 270). 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.14
    • changedInput schema / properties / op / enum
      Previous 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"
      -]New value: +[
      +  "clear",
      +  "erase_cell",
      +  "flip_cell",
      +  "generate_layout",
      +  "get_cell",
      +  "get_cells",
      +  "import_matrix",
      +  "paint_terrain",
      +  "place_tile",
      +  "rotate_cell",
      +  "scatter_props",
      +  "set_cell",
      +  "set_cells_rect",
      +  "tilemap_clear",
      +  "tilemap_erase_cell",
      +  "tilemap_flip_cell",
      +  "tilemap_generate_layout",
      +  "tilemap_get_cell",
      +  "tilemap_get_cells",
      +  "tilemap_import_matrix",
      +  "tilemap_paint_terrain",
      +  "tilemap_place_tile",
      +  "tilemap_rotate_cell",
      +  "tilemap_scatter_props",
      +  "tilemap_set_cell",
      +  "tilemap_set_cells_rect"
      +]
  2. 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"
      +]
  3. First observedv4.1.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations supplied, the description must carry the burden of behavioral disclosure. It does this well by noting that write operations are undoable via EditorUndoRedoManager, explaining source-ID remapping for specialized .tres files, and listing return shapes. Gaps remain for three operations present in the schema enum but absent from the description, but the documented operations are well covered.

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?

The description is long but well organized: purpose, directive, key concepts, then a labeled op list with signatures and return values. Each sentence carries meaning, though the lengthy op list and canonical-call note could be tightened. The front-loaded directive makes the most critical guidance immediately visible.

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

Completeness3/5

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

For a complex multi-operation tool with no annotations and minimal schema parameter coverage, the description provides substantial context: paths, undoability, source-ID remapping, operation signatures, and return values. It is incomplete, though, because the op enum includes import_matrix, paint_terrain, and scatter_props with no corresponding description or parameter semantics, leaving those invocations underspecified.

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

Parameters4/5

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

Schema description coverage is 0%, so the description compensates by providing inline signatures for each operation, explaining source_id, atlas_col/atlas_row, remapped source IDs, allowed rotation degrees, flip flags, and supported genres. However, import_matrix, paint_terrain, and scatter_props are listed in the op enum but have no parameter documentation, preventing a perfect score.

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?

The description opens with a clear verb-resource pairing: 'TileMap / TileMapLayer authoring (set tiles, fill rects, clear, read cells, generate layouts).' It enumerates concrete operations and explicitly targets an editor context, distinguishing this tool from nearby siblings like gridmap_manage and tileset_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' explicitly states when to use direct tile placement versus procedural GDScript generation, including the exception if the user requested runtime generation. It also scopes all operations to the currently edited scene and scene-relative paths, which is strong guidance for when and how to invoke the tool.

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

Deploy Server

Other Tools