Skip to main content
Glama
Mapbox MCP Server

Mapbox MCP Server

Official
by mapbox

Union Polygons

union_tool
Read-onlyIdempotent

Merge multiple polygons into one unified geometry to combine service areas, delivery zones, isochrones, or coverage regions; returns Polygon or MultiPolygon if inputs do not overlap.

Instructions

Merge two or more polygons into a single unified geometry. Useful for combining service areas, delivery zones, isochrones, or coverage regions. Returns a Polygon or MultiPolygon if the inputs do not overlap. Works offline without API calls. INPUT SHAPE: pass polygons as an array of polygons. Each polygon is an array of rings; each ring is an array of [lng, lat] pairs. When chaining with isochrone_tool, extract feature.geometry.coordinates from each isochrone Feature — that is already a valid Polygon value. Skip features whose geometry.type === "MultiPolygon" (pass each inner Polygon separately) or whose geometry.type === "LineString" (set isochrone_tool polygons=true to get Polygon output instead).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "polygons": "<polygons>"
    },
    "name": "union_tool"
  }
}

Input Schema

NameRequiredDescriptionDefault
polygonsYesArray of polygons to merge into a single union geometry

Output Schema

NameRequiredDescriptionDefault
typeYesGeometry type: Polygon or MultiPolygon
geometryYesGeoJSON geometry of the merged polygon (Polygon or MultiPolygon)
mapboxRenderNoMap-payload reference for `render_map_tool`. Surfaced so the LLM can chain the next call without re-emitting geometry.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changedv0.18.1
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • changedInput schema / properties / polygons / items / description
      Previous value: -"Polygon coordinates as array of rings (first is outer, rest are holes). Each ring is [longitude, latitude] pairs."New value: +"GeoJSON Polygon coordinates: an array of linear rings. The FIRST ring is the outer boundary; subsequent rings are interior holes. Each ring is an array of 4+ [longitude, latitude] coordinate pairs where the first and last are identical (closed ring). Example with one outer ring and no holes: [[[-77,38],[-76,38],[-76,39],[-77,39],[-77,38]]]. If you have a GeoJSON Feature with type=Polygon, pass `feature.geometry.coordinates` directly."
    • addedInput schema / properties / polygons / items / items / description
      Added value: +"A closed linear ring: 4+ [longitude, latitude] coordinate pairs where the first and last pair are identical (e.g. [[-77, 38], [-76, 38], [-76, 39], [-77, 39], [-77, 38]])."
    • addedInput schema / properties / polygons / items / items / minItems
      Added value: +4
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • changedOutput schema / additionalProperties
      Previous value: -falseNew value: +{}
    • addedOutput schema / properties / mapboxRender
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Map-payload reference for `render_map_tool`. Surfaced so the LLM can chain the next call without re-emitting geometry.",
      +  "properties": {
      +    "ref": {
      +      "description": "Server-side payload reference. Pass to `render_map_tool` via `payload_refs: [\"<this ref>\"]` to display the data on a live Mapbox GL JS map, or, in ChatGPT Desktop, to the `redraw_map` tool of the open Mapbox map.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "ref"
      +  ],
      +  "type": "object"
      +}
  2. First observedv0.12.6

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive, and closed-world, so the safety profile is covered; the description adds that it works offline without API calls and that the result is a Polygon or MultiPolygon. The overlap phrasing ("Returns a Polygon or MultiPolygon if the inputs do not overlap") is slightly ambiguous about which case yields which type but still signals that output geometry type varies.

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?

Front-loaded with purpose then a clearly labelled INPUT SHAPE block and a chaining paragraph, so an agent can stop reading early. Some sentences restate the schema's ring/coordinate description, which is mild redundancy in an otherwise tightly structured definition.

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

Completeness5/5

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

With only one required parameter, full schema coverage, an output schema, and rich annotations, the description covers everything else an agent needs: input construction, cross-tool chaining, and the failure modes (MultiPolygon/LineString inputs). Nothing material is missing.

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 coverage is 100%, so the nesting of coordinates is already documented; the description nonetheless reinforces the shape with a readable plain-language summary and, more valuably, explains how to source the value from another tool's output. It adds workflow meaning beyond the schema without contradicting it.

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?

States a specific verb and resource ("Merge two or more polygons into a single unified geometry") and lists concrete use cases (service areas, delivery zones, isochrones, coverage regions) that distinguish it from sibling geometry tools like difference_tool or intersect_tool.

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?

Gives explicit chaining guidance with isochrone_tool: extract `feature.geometry.coordinates`, skip MultiPolygon features by passing inner polygons separately, and skip LineString features by setting `polygons=true` upstream. This is exactly the when/how-to-route information an agent needs and it names the alternative actions rather than leaving them to inference.

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