Skip to main content
Glama

normalize_geometry

Standardize geometry orientation and order for consistent geospatial analysis. Input a WKT geometry to receive a normalized version as output.

Instructions

Normalize the orientation/order of a geometry using shapely.normalize. Args: geometry: WKT string of the geometry. Returns: Dictionary with status, message, and normalized geometry as WKT.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometryYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'normalize_geometry' tool. It takes a WKT geometry string, normalizes it using Shapely's normalize function, and returns the result as WKT in a status dictionary. Registered via the @gis_mcp.tool() decorator.
    @gis_mcp.tool()
    def normalize_geometry(geometry: str) -> Dict[str, Any]:
        """
        Normalize the orientation/order of a geometry using shapely.normalize.
        Args:
            geometry: WKT string of the geometry.
        Returns:
            Dictionary with status, message, and normalized geometry as WKT.
        """
        try:
            from shapely import wkt, normalize
            geom = wkt.loads(geometry)
            normalized = normalize(geom)
            return {
                "status": "success",
                "geometry": normalized.wkt,
                "message": "Geometry normalized successfully"
            }
        except Exception as e:
            logger.error(f"Error in normalize_geometry: {str(e)}")
            return {"status": "error", "message": str(e)}
  • Resource handler that lists 'normalize_geometry' among the available Shapely utility operations, indicating its registration in the MCP toolset.
    @gis_mcp.resource("gis://operations/shapely_util")
    def get_shapely_util_operations() -> Dict[str, List[str]]:
        """List available Shapely utility/advanced operations."""
        return {
            "operations": [
                "snap_geometry",
                "nearest_point_on_geometry",
                "normalize_geometry",
                "geometry_to_geojson",
                "geojson_to_geometry"
            ]
        }
  • Function signature and docstring defining the input schema (geometry: str) and output format (Dict with status, geometry WKT, message). Serves as the tool schema in this decorator-based MCP implementation.
    def normalize_geometry(geometry: str) -> Dict[str, Any]:
        """
        Normalize the orientation/order of a geometry using shapely.normalize.
        Args:
            geometry: WKT string of the geometry.
        Returns:
            Dictionary with status, message, and normalized geometry as WKT.
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool 'normalizes' geometry, implying a transformation, but doesn't specify whether this is destructive, reversible, or has side effects. It also lacks details on error handling, performance, or dependencies beyond the shapely reference, leaving significant gaps in understanding the tool's behavior.

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?

The description is well-structured and appropriately sized, with a clear purpose statement followed by 'Args:' and 'Returns:' sections. Each sentence adds value, though the 'Args:' and 'Returns:' labels could be more integrated. It avoids redundancy and is easy to parse, making it efficient for an agent.

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

Completeness4/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 (one parameter, no annotations, but with an output schema), the description is reasonably complete. It covers the purpose, parameter semantics, and return format, and the output schema handles return values. However, it lacks usage guidelines and behavioral details, which are notable gaps for a geometry transformation tool in a crowded sibling set.

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

Parameters4/5

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

The description adds meaningful context beyond the input schema, which has 0% description coverage. It explains that the 'geometry' parameter is a 'WKT string of the geometry,' clarifying the expected format. However, it doesn't detail constraints (e.g., valid geometry types) or examples, which slightly limits its utility. With one parameter and no schema descriptions, this is strong but not exhaustive.

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 tool's purpose: 'Normalize the orientation/order of a geometry using shapely.normalize.' It specifies the verb ('normalize'), resource ('geometry'), and implementation method ('using shapely.normalize'). However, it doesn't explicitly differentiate from sibling tools like 'rotate_geometry' or 'simplify' that might also modify geometries, which prevents a perfect score.

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. With many sibling tools that manipulate geometries (e.g., 'rotate_geometry', 'simplify', 'make_valid'), there's no indication of specific use cases, prerequisites, or exclusions. This lack of context leaves the agent guessing about appropriate application.

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