Skip to main content
Glama
Mapbox MCP Server

Mapbox MCP Server

Official
by mapbox

Calculate Centroid

centroid_tool
Read-onlyIdempotent

Calculate the geometric center of a polygon or multipolygon from coordinates to find the arithmetic mean position of all points offline without API calls.

Instructions

Calculate the geometric center (centroid) of a polygon or multipolygon. The centroid is the arithmetic mean position of all points in the shape. Works offline without API calls.

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": {
      "geometry": "<geometry>"
    },
    "name": "centroid_tool"
  }
}

Input Schema

NameRequiredDescriptionDefault
geometryYesPolygon or MultiPolygon coordinates. Polygon: array of rings (first is outer, rest are holes). MultiPolygon: array of polygons.

Output Schema

NameRequiredDescriptionDefault
centroidYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 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"
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
  2. First observedv0.12.6

TDQS

B3.2/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, openWorldHint=false, and destructiveHint=false, so the safety profile is covered. The description usefully corroborates the no-network behavior ('Works offline without API calls'), which matters for cost/latency decisions. It adds little else about behavior beyond that, so a 3 is appropriate.

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?

Three short sentences, front-loaded with the purpose and scope, with no filler. The middle sentence explaining 'arithmetic mean position of all points' is somewhat redundant and arguably imprecise for an area-weighted centroid, but it is brief and does not derail the definition.

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?

With an output schema present, full annotation coverage, and a single fully documented parameter, the description only needs to convey purpose and scope, which it does. Minor gaps remain around sibling differentiation and edge-case geometry behavior, but nothing an agent needs to invoke the tool correctly is missing.

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

Parameters3/5

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

Schema description coverage is 100%, and the schema itself spells out coordinate ordering ([longitude, latitude]) plus ring and polygon nesting. The description adds no parameter-level detail (e.g., winding order expectations or degenerate-shape handling), so the baseline 3 applies.

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

Purpose4/5

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

States a specific verb and resource ('Calculate the geometric center (centroid) of a polygon or multipolygon') and constrains the accepted geometry types, so an agent knows exactly what operation is performed. It does not name or contrast with nearby siblings such as midpoint_tool, convex_tool, or bbox_tool, which would have made the distinction sharper.

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

Usage Guidelines2/5

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

There is no explicit statement of when to prefer this tool over midpoint_tool, bbox_tool, or convex_tool, nor any exclusion or prerequisite. The only contextual cue is 'Works offline without API calls,' which hints at a local-computation family but does not tell an agent when to select this over alternatives.

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