Skip to main content
Glama

intersection

Calculate the overlapping area where two geographic shapes intersect to identify shared spatial regions.

Instructions

Find intersection of two geometries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometry1Yes
geometry2Yes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'intersection' MCP tool. It takes two WKT geometry strings, loads them with shapely.wkt.loads, computes their intersection, and returns the result as WKT in a standardized dict format.
    @gis_mcp.tool()
    def intersection(geometry1: str, geometry2: str) -> Dict[str, Any]:
        """Find intersection of two geometries."""
        try:
            from shapely import wkt
            geom1 = wkt.loads(geometry1)
            geom2 = wkt.loads(geometry2)
            result = geom1.intersection(geom2)
            return {
                "status": "success",
                "geometry": result.wkt,
                "message": "Intersection created successfully"
            }
        except Exception as e:
            logger.error(f"Error creating intersection: {str(e)}")
            raise ValueError(f"Failed to create intersection: {str(e)}")
  • Import statements in main.py that load the shapely_functions module, triggering automatic registration of all @gis_mcp.tool()-decorated functions, including 'intersection', via the FastMCP decorator system.
    from . import (
        geopandas_functions,
        shapely_functions,
        rasterio_functions,
        pyproj_functions,
        pysal_functions,
    )
  • src/gis_mcp/mcp.py:5-5 (registration)
    Definition of the central FastMCP server instance 'gis_mcp' used by decorators (@gis_mcp.tool()) to register tools like 'intersection'.
    gis_mcp = FastMCP("GIS MCP")
  • MCP resource handler that lists available basic Shapely operations, including 'intersection', for tool discovery.
    @gis_mcp.resource("gis://operations/basic")
    def get_basic_operations() -> Dict[str, List[str]]:
        """List available basic geometric operations."""
        return {
            "operations": [
                "buffer",
                "intersection",
                "union",
                "difference",
                "symmetric_difference"
            ]
        }
Behavior1/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but offers nothing beyond the basic operation. It doesn't specify what 'intersection' returns (e.g., geometry, boolean, area), error conditions, performance characteristics, or whether it modifies inputs. For a geometric operation with potential complexity, this is a significant gap.

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 a single, efficient sentence with zero wasted words. It's appropriately sized for a simple-sounding operation and front-loads the core action. However, this conciseness comes at the cost of completeness.

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

Completeness2/5

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

Given the complexity of geometric operations, no annotations, and 0% schema coverage, the description is inadequate. While an output schema exists (which relieves some burden), the description doesn't address critical context like input formats, geometric constraints, or common pitfalls. It's minimal for a tool that likely has nuanced behavior.

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?

The input schema has 0% description coverage, and the description doesn't add any parameter semantics. It doesn't explain what 'geometry1' and 'geometry2' represent (e.g., GeoJSON strings, WKT, file paths), their expected formats, or validation rules. The description fails to compensate for the schema's lack of documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Find intersection of two geometries' clearly states the verb ('find intersection') and resource ('geometries'), but it's vague about what 'intersection' means in this geometric context and doesn't distinguish it from sibling tools like 'difference' or 'symmetric_difference' that also operate on two geometries. The purpose is understandable but lacks specificity about the geometric operation.

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 like 'difference', 'union', or 'symmetric_difference' from the sibling list. It doesn't mention prerequisites, input formats, or typical use cases. The agent must infer usage solely from the tool name and basic description.

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