tiled-mcp

v1.0.3
io.github.fablenator/tiled-mcp Checked 1 day ago Published 3 months ago

Inspect, validate and surgically edit Tiled map files (.tmx/.tmj) — byte-preserving, 12 tools.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

map_info Map key figures

Key figures of a Tiled map: size, orientation, layers, tilesets, object counts, map properties. Whatever is not in the file is reported as n/a.

ParameterTypeDescription
path *stringPath to ONE Tiled map file (.tmx or .tmj) — no directory, no wildcards. Please pass it absolute: a relative path is resolved against the working directory of the server process, and that is chosen b…

list_layers List layers

All layers of the map in render order, recursively through group layers, with id, kind, size, encoding and visibility.

ParameterTypeDescription
path *stringPath to ONE Tiled map file (.tmx or .tmj) — no directory, no wildcards. Please pass it absolute: a relative path is resolved against the working directory of the server process, and that is chosen b…

read_layer Read layer contents

Reads the tiles of a tile layer, optionally only a sub-rectangle. Outputs raw GID values including flip bits (0 = empty cell). If the output is truncated, that is stated visibly.

ParameterTypeDescription
path *stringPath to ONE Tiled map file (.tmx or .tmj) — no directory, no wildcards. Please pass it absolute: a relative path is resolved against the working directory of the server process, and that is chosen b…
heightintegerHeight of the region. Default: to the bottom edge.
layerstringName of the layer; inside groups also 'group/layer'. Alternatively use layer_id.
layer_idintegerId of the layer. Unique, unlike the name. Alternatively use layer.
max_cellsintegerUpper limit of cells in the output. Default 2048.
widthintegerWidth of the region. Default: to the right edge.
with_flagsbooleantrue shows 'index[HVD]' instead of the raw value. Default: false.
xintegerLeft edge of the region in tiles. Default 0.
yintegerTop edge of the region in tiles. Default 0.

tile_stats Tile usage

Usage histogram: which tile index occurs how often, which tiles of a tileset are unused, how many cells are empty and which flip-bit combinations occur.

ParameterTypeDescription
path *stringPath to ONE Tiled map file (.tmx or .tmj) — no directory, no wildcards. Please pass it absolute: a relative path is resolved against the working directory of the server process, and that is chosen b…
layerstringName of the layer; inside groups also 'group/layer'. Alternatively use layer_id.
layer_idintegerId of the layer. Unique, unlike the name. Alternatively use layer.
max_entriesintegerUpper limit per list. Default 100. Truncation is reported.

find_tiles Find tiles

Finds every occurrence of a tile and returns its coordinates. Either via gid (flip bits are masked out) or via a tile property from the tileset.

ParameterTypeDescription
path *stringPath to ONE Tiled map file (.tmx or .tmj) — no directory, no wildcards. Please pass it absolute: a relative path is resolved against the working directory of the server process, and that is chosen b…
gidintegerGID to look for. Compared on the tile index without flip bits.
layerstringName of the layer; inside groups also 'group/layer'. Alternatively use layer_id.
layer_idintegerId of the layer. Unique, unlike the name. Alternatively use layer.
limitintegerUpper limit of hits shown. Default 200.
propertystringAlternatively: name of a tile property from the tileset.
valuestringOptional value for property, compared as text.

replace_tiles Replace tiles

Replaces tile A with tile B, optionally only in one layer and/or one rectangle. Comparison and writing happen on the tile index; the flip bits of every cell are kept. Writes the file only if there really is something to change.

ParameterTypeDescription
from_gid *integerGID to replace. Compared on the tile index.
path *stringPath to ONE Tiled map file (.tmx or .tmj) — no directory, no wildcards. Please pass it absolute: a relative path is resolved against the working directory of the server process, and that is chosen b…
to_gid *integerNew GID. 0 clears the cell.
dry_runbooleantrue = compute and report everything, but write nothing. Default: false.
heightintegerHeight of the rectangle. Default: to the bottom edge.
keep_flagsbooleantrue (default): every cell keeps its flip bits. false: the flip bits from to_gid apply.
layerstringName of the layer; inside groups also 'group/layer'. Alternatively use layer_id.
layer_idintegerId of the layer. Unique, unlike the name. Alternatively use layer.
widthintegerWidth of the rectangle. Default: to the right edge.
xintegerLeft edge of the rectangle. Default 0.
yintegerTop edge of the rectangle. Default 0.

fill_region Fill a rectangle

Fills a rectangle of a tile layer with one tile. gid=0 clears the cells. A rectangle outside the layer is rejected, not clipped.

ParameterTypeDescription
gid *integerGID of the fill tile, flip bits allowed. 0 clears the cells.
height *integerHeight of the rectangle in tiles.
path *stringPath to ONE Tiled map file (.tmx or .tmj) — no directory, no wildcards. Please pass it absolute: a relative path is resolved against the working directory of the server process, and that is chosen b…
width *integerWidth of the rectangle in tiles.
x *integerLeft edge of the rectangle in tiles.
y *integerTop edge of the rectangle in tiles.
dry_runbooleantrue = compute and report everything, but write nothing. Default: false.
layerstringName of the layer; inside groups also 'group/layer'. Alternatively use layer_id.
layer_idintegerId of the layer. Unique, unlike the name. Alternatively use layer.

validate_map Validate a map

Checks the map: missing tileset, image and file-property files, GIDs outside the tilesets, duplicate layer and object ids, nextlayerid/nextobjectid that are too small, object properties pointing nowhere. Every finding has its own code and its own message. The answer always names both: which classes were checked and which are NOT checked in v1. If the map cannot be loaded at all, that is stated as a finding and all content checks are n/a.

ParameterTypeDescription
path *stringPath to ONE Tiled map file (.tmx or .tmj) — no directory, no wildcards. Please pass it absolute: a relative path is resolved against the working directory of the server process, and that is chosen b…

objects_list List objects

Lists the objects of the object layers with id, name, type, shape, position, size, rotation, gid and properties. Optionally filtered by layer, id, name or type.

ParameterTypeDescription
path *stringPath to ONE Tiled map file (.tmx or .tmj) — no directory, no wildcards. Please pass it absolute: a relative path is resolved against the working directory of the server process, and that is chosen b…
idintegerOnly the object with this id.
layerstringName of the layer; inside groups also 'group/layer'. Alternatively use layer_id.
layer_idintegerId of the layer. Unique, unlike the name. Alternatively use layer.
limitintegerUpper limit of objects shown. Default 200.
namestringOnly objects with this name.
typestringOnly objects with this class (attribute type).

object_upsert Create or change an object

Without id: creates a new object (rectangle, or a tile object when gid is given); the id comes from nextobjectid, which is raised afterwards. With id: changes exactly the fields that were passed. Shape changes and template instances are not editable in v1 and are rejected.

ParameterTypeDescription
path *stringPath to ONE Tiled map file (.tmx or .tmj) — no directory, no wildcards. Please pass it absolute: a relative path is resolved against the working directory of the server process, and that is chosen b…
dry_runbooleantrue = compute and report everything, but write nothing. Default: false.
gidintegerGID for a tile object, flip bits allowed.
heightnumberHeight in pixels.
idintegerId of an existing object. Without id a new one is created.
layerstringName of the layer; inside groups also 'group/layer'. Alternatively use layer_id.
layer_idintegerId of the layer. Unique, unlike the name. Alternatively use layer.
namestringName of the object.
rotationnumberRotation in degrees, clockwise.
typestringClass of the object (attribute type).
visiblebooleanVisibility of the object.
widthnumberWidth in pixels.
xnumberX position in pixels. Required when creating.
ynumberY position in pixels. Required when creating.

object_delete Delete an object

Deletes an object by its id. nextobjectid stays unchanged, because Tiled never reuses deleted ids.

ParameterTypeDescription
id *integerId of the object to delete.
path *stringPath to ONE Tiled map file (.tmx or .tmj) — no directory, no wildcards. Please pass it absolute: a relative path is resolved against the working directory of the server process, and that is chosen b…
dry_runbooleantrue = compute and report everything, but write nothing. Default: false.
layerstringName of the layer; inside groups also 'group/layer'. Alternatively use layer_id.
layer_idintegerId of the layer. Unique, unlike the name. Alternatively use layer.

map_summary Map summary

Markdown summary of a map for chat context: key figures, layers, tilesets, properties, objects and the warnings from loading.

ParameterTypeDescription
path *stringPath to ONE Tiled map file (.tmx or .tmj) — no directory, no wildcards. Please pass it absolute: a relative path is resolved against the working directory of the server process, and that is chosen b…