Skip to main content
Glama

get_length

Calculate geometry length for spatial measurements in GIS analysis. Input a geometry string to get accurate length results.

Instructions

Get the length of a geometry.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometryYes

Implementation Reference

  • The handler function that implements the get_length tool logic, using Shapely to compute the length of a WKT geometry and return it in a standardized dict format. The @gis_mcp.tool() decorator registers it as an MCP tool.
    @gis_mcp.tool() def get_length(geometry: str) -> Dict[str, Any]: """Get the length of a geometry.""" try: from shapely import wkt geom = wkt.loads(geometry) return { "status": "success", "length": float(geom.length), "message": "Length calculated successfully" } except Exception as e: logger.error(f"Error calculating length: {str(e)}") raise ValueError(f"Failed to calculate length: {str(e)}")
  • Resource handler that lists 'get_length' among available measurement operations for discovery.
    @gis_mcp.resource("gis://operations/measurements") def get_measurements() -> Dict[str, List[str]]: """List available measurement operations.""" return { "operations": [ "get_length", "get_area" ] }

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