Skip to main content
Glama

unary_union_geometries

Combine multiple geometries into a single unified shape for spatial analysis and data simplification in GIS workflows.

Instructions

Create a union of multiple geometries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geometriesYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'unary_union_geometries' tool. It takes a list of WKT geometry strings, computes their unary union using Shapely's unary_union, and returns the resulting geometry as WKT in a success dictionary.
    @gis_mcp.tool()
    def unary_union_geometries(geometries: List[str]) -> Dict[str, Any]:
        """Create a union of multiple geometries."""
        try:
            from shapely import wkt
            from shapely.ops import unary_union
            geoms = [wkt.loads(g) for g in geometries]
            result = unary_union(geoms)
            return {
                "status": "success",
                "geometry": result.wkt,
                "message": "Union created successfully"
            }
        except Exception as e:
            logger.error(f"Error creating union: {str(e)}")
            raise ValueError(f"Failed to create union: {str(e)}")
  • Registers 'unary_union_geometries' in the list of available advanced GIS operations accessible via the 'gis://operations/advanced' resource.
    @gis_mcp.resource("gis://operations/advanced")
    def get_advanced_operations() -> Dict[str, List[str]]:
        """List available advanced operations."""
        return {
            "operations": [
                "triangulate_geometry",
                "voronoi",
                "unary_union_geometries"
            ]
        }
Behavior1/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 only states the basic purpose without mentioning critical details: what format the geometries should be in (e.g., GeoJSON, WKT), how the union is computed, whether it handles invalid geometries, what the output looks like (though an output schema exists), or any performance implications. This is inadequate for a tool that performs geometric operations.

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, direct sentence with no wasted words. It's front-loaded with the core action ('Create a union'), making it easy to scan. However, this conciseness comes at the cost of completeness, as it omits necessary details for effective use.

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 and the lack of annotations, the description is insufficient. While an output schema exists (which mitigates the need to describe return values), it fails to address key contextual elements: how geometries are specified, differences from the 'union' sibling tool, error conditions, or computational behavior. For a tool in a spatial analysis server with many siblings, this leaves significant gaps in understanding.

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, documenting only that 'geometries' is a required array of strings. The description adds no semantic information about the parameter—it doesn't explain what the strings represent (e.g., geometry encodings), valid formats, constraints (e.g., minimum number of geometries), or examples. This leaves the parameter poorly understood despite the schema's structural definition.

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 'Create a union of multiple geometries' clearly states the action (create a union) and resource (geometries), but it's vague about what a 'union' means in this context. It doesn't distinguish from the sibling tool 'union', which appears to be a similar operation, leaving ambiguity about when to use one versus the other.

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 a sibling tool named 'union' that likely performs a similar geometric union operation, there's no indication of differences (e.g., unary vs binary operations, input formats, or performance characteristics). This lack of distinction could lead to incorrect tool selection.

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