Skip to main content
Glama

spatial_calc

Read-onlyIdempotent

Calculate geometry relations, point-in-polygon checks, geodesic distance and bearing, bbox grid splits, and camera frustum ground footprints offline with deterministic results and no network calls.

Instructions

Perform deterministic offline geometric calculations on bounding boxes, points, polygons, and 3D camera frustums (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' (WGS84 ellipsoidal Vincenty distance, initial/final bearings, geodesic midpoint, and ENU vector between two points), 'split_grid' (subdivide a bbox into an N x M grid), or 'camera_footprint' (3D ray-ellipsoid intersection to project a drone/aerial camera frustum onto the WGS84 ground polygon).

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": {
      "operation": "<operation>",
      "bbox_a": "<bbox_a>"
    },
    "name": "spatial_calc"
  }
}

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'), origin point 'lat,lng' (for 'distance_bearing'), or camera position 'lat,lng' (for 'camera_footprint').
bbox_bNoSecond geometry / bounding box (for 'relation') or destination point 'lat,lng' (for 'distance_bearing').
operationYesThe geometric operation to perform.
fov_degreesNoHorizontal camera field of view in degrees for 'camera_footprint' (5 to 150, default 60).
aspect_ratioNoImage width/height aspect ratio for 'camera_footprint' (0.2 to 5, default 16/9).
roll_degreesNoCamera roll angle in degrees around look axis for 'camera_footprint' (default 0).
pitch_degreesNoCamera pitch angle in degrees for 'camera_footprint': -90 is straight down (nadir, default), -2 is near horizontal.
altitude_metersNoCamera altitude in meters above WGS84 ellipsoid for 'camera_footprint' (> 0, <= 100000).
heading_degreesNoCamera azimuth/heading in degrees clockwise from North for 'camera_footprint' (default 0).
max_ray_distance_metersNoMaximum slant ray clamp distance in meters when frustum corners approach the horizon (defaults to max(50000, altitude_meters * 10)).

Output Schema

NameRequiredDescriptionDefault
toNo
bboxNo
colsNo
fromNo
rowsNo
cellsNo
pointNo
cameraNo
insideNo
area_km2No
completeYes
midpointNo
warningsYes
ellipsoidNo
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
center_targetNo
footprint_wktNo
original_bboxNo
inside_polygonNo
union_area_km2No
bearing_degreesNo
distance_metersNo
enu_vector_metersNo
footprint_cornersNo
footprint_geojsonNo
intersection_bboxNo
cardinal_directionNo
clamped_to_horizonNo
overlap_percent_of_aNo
overlap_percent_of_bNo
final_bearing_degreesNo
intersection_area_km2No
centroid_distance_metersNo
spherical_distance_metersNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed20 schema fields changedv1.7.0
    • addedInput schema / properties / altitude_meters
      Added value: +{
      +  "description": "Camera altitude in meters above WGS84 ellipsoid for 'camera_footprint' (> 0, <= 100000).",
      +  "type": "number"
      +}
    • addedInput schema / properties / aspect_ratio
      Added value: +{
      +  "description": "Image width/height aspect ratio for 'camera_footprint' (0.2 to 5, default 16/9).",
      +  "type": "number"
      +}
    • changedInput schema / properties / bbox_a / description
      Previous value: -"First geometry / bounding box (for 'relation', 'point_in_geometry', 'split_grid') or origin point 'lat,lng' (for 'distance_bearing')."New value: +"First geometry / bounding box (for 'relation', 'point_in_geometry', 'split_grid'), origin point 'lat,lng' (for 'distance_bearing'), or camera position 'lat,lng' (for 'camera_footprint')."
    • addedInput schema / properties / fov_degrees
      Added value: +{
      +  "description": "Horizontal camera field of view in degrees for 'camera_footprint' (5 to 150, default 60).",
      +  "type": "number"
      +}
    • addedInput schema / properties / heading_degrees
      Added value: +{
      +  "description": "Camera azimuth/heading in degrees clockwise from North for 'camera_footprint' (default 0).",
      +  "type": "number"
      +}
    • addedInput schema / properties / max_ray_distance_meters
      Added value: +{
      +  "description": "Maximum slant ray clamp distance in meters when frustum corners approach the horizon (defaults to max(50000, altitude_meters * 10)).",
      +  "type": "number"
      +}
    • changedInput schema / properties / operation / enum
      Previous value: -[
      -  "relation",
      -  "point_in_geometry",
      -  "distance_bearing",
      -  "split_grid"
      -]New value: +[
      +  "relation",
      +  "point_in_geometry",
      +  "distance_bearing",
      +  "split_grid",
      +  "camera_footprint"
      +]
    • addedInput schema / properties / pitch_degrees
      Added value: +{
      +  "description": "Camera pitch angle in degrees for 'camera_footprint': -90 is straight down (nadir, default), -2 is near horizontal.",
      +  "type": "number"
      +}
    • addedInput schema / properties / roll_degrees
      Added value: +{
      +  "description": "Camera roll angle in degrees around look axis for 'camera_footprint' (default 0).",
      +  "type": "number"
      +}
    • addedOutput schema / properties / area_km2
      Added value: +{
      +  "type": "number"
      +}
    • addedOutput schema / properties / camera
      Added value: +{
      +  "type": "object"
      +}
    • addedOutput schema / properties / center_target
      Added value: +{
      +  "type": "object"
      +}
    • addedOutput schema / properties / clamped_to_horizon
      Added value: +{
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / ellipsoid
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / enu_vector_meters
      Added value: +{
      +  "type": "object"
      +}
    • addedOutput schema / properties / final_bearing_degrees
      Added value: +{
      +  "type": "number"
      +}
    • addedOutput schema / properties / footprint_corners
      Added value: +{
      +  "type": "object"
      +}
    • addedOutput schema / properties / footprint_geojson
      Added value: +{
      +  "type": "object"
      +}
    • addedOutput schema / properties / footprint_wkt
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / spherical_distance_meters
      Added value: +{
      +  "type": "number"
      +}
  2. Addedv1.5.0

TDQS

A4/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 reinforces this with 'deterministic offline ... zero network calls'. It adds genuine behavioral detail beyond annotations: the specific algorithms (Vincenty ellipsoidal distance, 3D ray-ellipsoid intersection) and the horizon-clamping behavior via max_ray_distance_meters, which signals where the calculation degrades.

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 and then structured as a scannable operation list with each mode's inputs and outputs. It is a single dense sentence with heavy parenthetical nesting, which is slightly hard to parse, but no sentence is redundant.

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?

For a 13-parameter tool with a full output schema and rich annotations, the description covers the one thing structured fields cannot: what each operation mode actually computes and the algorithmic basis. Coordinate conventions, ranges, and defaults all live in the schema, so nothing an agent needs to invoke it 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 coverage is 100%, so every parameter's role is already documented in the schema, including which operation consumes bbox_a and bbox_b. The description adds semantic depth about what the operations produce (overlap area %, union & intersection bbox, interior holes, ENU vector) but does not extend per-parameter meaning beyond the schema, so baseline 3 applies.

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 ('Perform deterministic offline geometric calculations') and then enumerates all five operations with their inputs and outputs, so an agent knows exactly what the tool computes. The emphasis on 'offline ... zero network calls' distinguishes it from the network-bound OSM siblings in the catalog.

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

Usage Guidelines3/5

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

Usage is implied through the operation list and the 'offline, no network calls' framing, which tells an agent this is the local-math path. However, it never names an alternative or states when NOT to use it (e.g., when a server-side geometry service would be preferred), and gives no guidance on choosing among the five operations beyond their names.

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