Skip to main content
Glama

is_valid

Validate geometry data for GIS operations by checking if it meets geospatial standards and can be used in spatial analysis.

Instructions

Check if a geometry is valid.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometryYes

Implementation Reference

  • The handler function for the 'is_valid' MCP tool. It parses WKT geometry using Shapely, checks if it is valid with geom.is_valid, and returns a dictionary containing the validation status.
    @gis_mcp.tool()
    def is_valid(geometry: str) -> Dict[str, Any]:
        """Check if a geometry is valid."""
        try:
            from shapely import wkt
            geom = wkt.loads(geometry)
            return {
                "status": "success",
                "is_valid": bool(geom.is_valid),
                "message": "Geometry validation completed successfully"
            }
        except Exception as e:
            logger.error(f"Error validating geometry: {str(e)}")
            raise ValueError(f"Failed to validate geometry: {str(e)}")
  • The @gis_mcp.tool() decorator registers the is_valid function as an MCP tool.
    @gis_mcp.tool()
  • Resource listing that includes 'is_valid' among available validation operations.
    @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