Skip to main content
Glama

make_valid

Fix invalid geometries in GIS data to ensure accurate geospatial analysis and prevent processing errors.

Instructions

Make a geometry valid.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometryYes

Implementation Reference

  • The handler function decorated with @gis_mcp.tool() that implements the 'make_valid' tool. It parses WKT geometry, applies Shapely's make_valid to fix invalid geometries, and returns the result as WKT.
    @gis_mcp.tool() def make_valid(geometry: str) -> Dict[str, Any]: """Make a geometry valid.""" try: from shapely import wkt, make_valid geom = wkt.loads(geometry) result = make_valid(geom) return { "status": "success", "geometry": result.wkt, "message": "Geometry made valid successfully" } except Exception as e: logger.error(f"Error making geometry valid: {str(e)}") raise ValueError(f"Failed to make geometry valid: {str(e)}")
  • Resource listing that includes 'make_valid' among available validation operations, indicating its registration in the MCP toolset.
    @gis_mcp.resource("gis://operations/validation") def get_validation_operations() -> Dict[str, List[str]]: """List available validation operations.""" return { "operations": [ "is_valid", "make_valid", "simplify" ] }

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