Skip to main content
Glama

spatial_calc

Read-onlyIdempotent

Compute deterministic geometric relations, point-in-polygon tests with holes, Haversine distance and bearing, or split bounding boxes into grids for chunked queries offline.

Instructions

Perform deterministic offline geometric calculations on bounding boxes, points, and polygons (with holes, zero network calls): 'relation' (intersects, contains, overlap area %, union & intersection bbox between two geometries), 'point_in_geometry' (check if a point is inside a bbox or WKT/GeoJSON polygon respecting interior holes), 'distance_bearing' (exact Haversine distance, initial compass bearing, and midpoint between two points), or 'split_grid' (subdivide a bbox into an N x M grid of sub-bboxes for chunked queries).

Input Schema

NameRequiredDescriptionDefault
colsNoNumber of longitude columns for 'split_grid' (1-20, default 2).
rowsNoNumber of latitude rows for 'split_grid' (1-20, default 2).
pointNoPoint coordinates 'lat,lng' to test in 'point_in_geometry'.
bbox_aYesFirst geometry / bounding box (for 'relation', 'point_in_geometry', 'split_grid') or origin point 'lat,lng' (for 'distance_bearing').
bbox_bNoSecond geometry / bounding box (for 'relation') or destination point 'lat,lng' (for 'distance_bearing').
operationYesThe geometric operation to perform.

Output Schema

NameRequiredDescriptionDefault
toNo
bboxNo
colsNo
fromNo
rowsNo
cellsNo
pointNo
insideNo
completeYes
midpointNo
warningsYes
operationYes
share_urlYes
area_a_km2No
area_b_km2No
intersectsNo
provenanceYes
union_bboxNo
distance_kmNo
inside_bboxNo
target_bboxNo
total_cellsNo
a_contains_bNo
b_contains_aNo
original_bboxNo
inside_polygonNo
union_area_km2No
bearing_degreesNo
distance_metersNo
intersection_bboxNo
cardinal_directionNo
overlap_percent_of_aNo
overlap_percent_of_bNo
intersection_area_km2No
centroid_distance_metersNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.5.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive, closed-world, so the safety profile is covered. The description adds genuine behavioral context beyond them: deterministic results, no network access, interior holes respected in containment tests, and grid bounds of 1-20 with default 2. It does not describe failure modes for malformed WKT or out-of-range rows/cols, but the added disclosure is substantive.

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 the core purpose, then a single structured enumeration of the four operations. Dense with parenthetical detail but nearly every clause carries operational information; the one-sentence mega-structure is slightly harder to scan than a short bulleted layout would be.

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, return values need no explanation, and all four operation modes plus their parameter roles are covered. What remains thin is edge-case behavior (invalid geometry input, behavior when bbox_a is a polygon for split_grid), which keeps it just short of fully complete for a six-parameter multi-mode tool.

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 baseline is 3; the description earns above it by clarifying geometry formats the schema leaves generic ('bbox or WKT/GeoJSON polygon', 'lat,lng' origin/destination) and by tying cols/rows to the split_grid subdivision semantics. The mapping of which parameter is consumed by which operation is spelled out in prose as well as schema.

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 ('deterministic offline geometric calculations on bounding boxes, points, and polygons') and then enumerates the four operations with their outputs (overlap area %, union & intersection bbox, Haversine distance, N x M grid). The 'zero network calls' clause separates it from network-dependent siblings like reverse_geocode and search_overpass.

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

Usage Guidelines4/5

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

Each operation name is paired with the condition that selects it (use 'relation' for two-geometry comparison, 'point_in_geometry' for point-in-polygon with holes, 'distance_bearing' for point pairs, 'split_grid' for chunked queries), which is effectively mode-selection guidance. It stops short of naming an explicit sibling alternative or stating when not to use it, so it is clear context rather than full when/when-not routing.

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