Skip to main content
Glama

calculate_geodetic_distance

Calculate accurate distance between geographic coordinates on Earth's surface using geodetic methods for GIS analysis and spatial measurements.

Instructions

Calculate geodetic distance between points.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
point1Yes
point2Yes
ellpsNoWGS84

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that executes the tool logic: calculates geodetic distance, azimuths using pyproj.Geod.inv between two lon/lat points.
    @gis_mcp.tool()
    def calculate_geodetic_distance(point1: List[float], point2: List[float], 
                                ellps: str = "WGS84") -> Dict[str, Any]:
        """Calculate geodetic distance between points."""
        try:
            import pyproj
            geod = pyproj.Geod(ellps=ellps)
            lon1, lat1 = point1
            lon2, lat2 = point2
            forward_azimuth, back_azimuth, distance = geod.inv(lon1, lat1, lon2, lat2)
            return {
                "status": "success",
                "distance": distance,
                "forward_azimuth": forward_azimuth,
                "back_azimuth": back_azimuth,
                "ellps": ellps,
                "unit": "meters",
                "message": "Geodetic distance calculated successfully"
            }
        except Exception as e:
            logger.error(f"Error calculating geodetic distance: {str(e)}")
            raise ValueError(f"Failed to calculate geodetic distance: {str(e)}")
  • Resource endpoint listing available geodetic tools, including 'calculate_geodetic_distance', serving as tool discovery/schema.
    @gis_mcp.resource("gis://crs/geodetic")
    def get_geodetic_operations() -> Dict[str, List[str]]:
        """List available geodetic operations."""
        return {
            "operations": [
                "get_geod_info",
                "calculate_geodetic_distance",
                "calculate_geodetic_point",
                "calculate_geodetic_area"
            ]
        }
  • src/gis_mcp/mcp.py:2-5 (registration)
    MCP server instance 'gis_mcp' creation via FastMCP, to which tools are registered via decorators.
    from fastmcp import FastMCP
    
    
    gis_mcp = FastMCP("GIS MCP")
Behavior1/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but offers none. It doesn't mention whether this is a read-only operation, what units the distance is returned in, precision considerations, or potential limitations (e.g., large distances, coordinate systems). For a calculation tool with zero annotation coverage, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with a single sentence that directly states the tool's function. There is zero wasted language, and it's front-loaded with the core purpose. This is appropriate conciseness for a simple calculation tool.

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

Completeness3/5

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

Given the tool's moderate complexity (geodetic calculations require coordinate understanding) and the presence of an output schema (which handles return values), the description is minimally complete. However, with no annotations and 0% schema description coverage, it leaves significant gaps in behavioral and parameter understanding that the output schema alone doesn't address.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate but adds no parameter information. It doesn't explain that point1 and point2 should be [longitude, latitude] arrays, what coordinate reference system they should use, or what the 'ellps' parameter controls (ellipsoid model). The description fails to provide meaning beyond the bare schema.

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?

The description clearly states the verb 'calculate' and the resource 'geodetic distance between points', making the purpose immediately understandable. It distinguishes from sibling tools like 'calculate_geodetic_area' by specifying distance rather than area, though it doesn't explicitly contrast with other distance-related tools like 'distance_band_weights'.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'calculate_geodetic_area' or 'distance_band_weights', nor does it specify use cases or prerequisites. The agent must infer usage from the name alone.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mahdin75/gis-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server