Skip to content

Tools

These are the tools and parameters an agent sees, taken from the server with every toolset on. The descriptions are the ones the agent reads.

Tools that take a style accept it in one of three ways: as an object in style, as a URL in url, or as a file in path, relative to the directory the server runs in.

These tools are in the style toolset, which is on by default. format_style and migrate_style write to the file given in path, and the others only read.

Checks a MapLibre style against the MapLibre Style Specification and lists every problem, each with the path to the property it is about. Run it after editing a style. Pass the style as an object, a URL or a file path.

Parameter Type Description
style object The style as a JSON object.
url URL URL of a style JSON document.
path string Path to a style JSON file, relative to the directory the server runs in.

Looks up a name in the MapLibre Style Specification: a layer type (like "fill"), a layer or root property (like "fill-extrusion-height" or "sky"), a source type (like "geojson") or an expression operator (like "interpolate"). Returns its documentation, type, default, allowed values, expression support and which MapLibre GL JS and MapLibre Native versions support it. Check here before using a property you are not sure exists in MapLibre, since Mapbox GL JS has properties that MapLibre does not.

Parameter Type Description
name string, required The name to look up.

Reads the metadata of every source in a MapLibre style (TileJSON, PMTiles headers and GeoJSON data) and lists the source layers and fields each one provides. Then checks that every layer uses a source, source layer and fields that exist. Use it before writing layers against data you do not know, and when a layer draws nothing. Pass the style as an object, a URL or a file path.

Parameter Type Description
style object The style as a JSON object.
url URL URL of a style JSON document.
path string Path to a style JSON file, relative to the directory the server runs in.

Formats a MapLibre style with the keys in the order of the style specification and two space indentation, the same way as gl-style-format. A style given as a file path is formatted in place, otherwise the formatted JSON is returned.

Parameter Type Description
style object The style as a JSON object.
url URL URL of a style JSON document.
path string Path to a style JSON file, relative to the directory the server runs in.

Migrates an old style to the current MapLibre Style Specification, the same way as gl-style-migrate: version 7 styles become version 8, and legacy functions and filters become expressions. A style given as a file path is migrated in place, otherwise the migrated JSON is returned.

Parameter Type Description
style object The style as a JSON object.
url URL URL of a style JSON document.
path string Path to a style JSON file, relative to the directory the server runs in.

These tools come with any of the renderer toolsets, gl-js, native and martin. The renderer parameter offers the renderers that are on, with the first as the default, and compare_renderers needs two of them. Rendering covers what each renderer needs.

Renders a MapLibre style to a PNG image, so you can see what the style looks like, for example after changing it. Also reports what the renderer noticed, such as style errors, failed requests and missing icons. Pass the style as an object, a URL or a file path. Without center, zoom or bounds, the camera stored in the style is used.

Parameter Type Description
style object The style as a JSON object.
url URL URL of a style JSON document.
path string Path to a style JSON file, relative to the directory the server runs in.
renderer gl-js, native or martin The MapLibre renderer to draw with. Defaults to gl-js.
center 2 numbers [longitude, latitude] of the map center.
zoom number, 0 to 24
bearing number The compass direction at the top of the map, in degrees.
pitch number, 0 to 85 Tilt in degrees from looking straight down.
bounds 4 numbers [west, south, east, north] to fit the map to, instead of center and zoom.
width integer, 64 to 2048 Defaults to 800.
height integer, 64 to 2048 Defaults to 600.

Renders two versions of a MapLibre style at the same camera, and returns one image with the style before, the style after, and their differences in red. Use it after changing a style, to check that the change did what you meant and nothing else, at a few places and zoom levels. Pass each style as an object, a URL or a file path.

Parameter Type Description
before object, required The style before the change.
before.style object The style as a JSON object.
before.url URL URL of a style JSON document.
before.path string Path to a style JSON file, relative to the directory the server runs in.
after object, required The style after the change.
after.style object The style as a JSON object.
after.url URL URL of a style JSON document.
after.path string Path to a style JSON file, relative to the directory the server runs in.
renderer gl-js, native or martin The MapLibre renderer to draw both with. Defaults to gl-js.
center 2 numbers [longitude, latitude] of the map center.
zoom number, 0 to 24
bearing number The compass direction at the top of the map, in degrees.
pitch number, 0 to 85 Tilt in degrees from looking straight down.
bounds 4 numbers [west, south, east, north] to fit the map to, instead of center and zoom.
width integer, 64 to 1024 Width of each of the three images. Defaults to 512.
height integer, 64 to 1024 Defaults to 384.

Renders one MapLibre style with two renderers, like MapLibre GL JS for the web and MapLibre Native for iOS and Android, and returns one image with both and their differences in red. Use it to check that a style looks the same everywhere it is used.

Parameter Type Description
style object The style as a JSON object.
url URL URL of a style JSON document.
path string Path to a style JSON file, relative to the directory the server runs in.
renderers 2 of gl-js, native and martin The two renderers to compare. Defaults to ["gl-js","native"].
center 2 numbers [longitude, latitude] of the map center.
zoom number, 0 to 24
bearing number The compass direction at the top of the map, in degrees.
pitch number, 0 to 85 Tilt in degrees from looking straight down.
bounds 4 numbers [west, south, east, north] to fit the map to, instead of center and zoom.
width integer, 64 to 1024 Width of each of the three images. Defaults to 512.
height integer, 64 to 1024 Defaults to 384.

show_map is in the gl-js toolset, which is on by default. The user sees the map in clients that support MCP Apps, like Claude and VS Code.

Shows the user an interactive MapLibre map in the chat, with GeoJSON layers and markers on an OpenFreeMap basemap. The user sees the map and you do not; to look at a map yourself, use render_style. Without center and zoom, the map fits the layers and markers. Needs a client that supports MCP Apps.

Parameter Type Description
layers array of objects Defaults to [].
layers[].type fill, line, circle, symbol, fill-extrusion or heatmap, required
layers[].data object, required A GeoJSON FeatureCollection, Feature or geometry.
layers[].paint object Paint properties for the layer type, like {"fill-color": "#d33"}.
layers[].layout object Layout properties for the layer type.
markers array of objects Defaults to [].
markers[].position 2 numbers, required [longitude, latitude]
markers[].label string Shown in a popup when the user clicks the marker.
markers[].color string
basemap liberty, bright, positron, dark or fiord The OpenFreeMap style to draw on. Defaults to liberty.
center 2 numbers [longitude, latitude] of the map center.
zoom number, 0 to 22
bearing number
pitch number, 0 to 85

martin_list_sources is in the martin toolset.

Lists the tile sources, sprites, fonts and styles that a Martin tile server serves, with the URLs to put in a MapLibre style. Follow up with describe_sources on a style that uses a tile source, to see its source layers and fields.

Parameter Type Description
url URL Base URL of the Martin server. Defaults to MARTIN_URL, or http://localhost:3000.