Skip to main content
Glama

get_utm_zone

Determine the UTM zone for geographic coordinates to enable accurate geospatial analysis and coordinate transformations in mapping applications.

Instructions

Get UTM zone for given coordinates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coordinatesYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that implements the get_utm_zone tool logic using pyproj to query UTM CRS info and extract the zone number from coordinates.
    @gis_mcp.tool()
    def get_utm_zone(coordinates: List[float]) -> Dict[str, Any]:
        """Get UTM zone for given coordinates."""
        try:
            import pyproj
            from pyproj.database import query_utm_crs_info
            lon, lat = coordinates
            crs_info_list = query_utm_crs_info(
                datum_name="WGS 84",  # Use "WGS 84" with space as per standard
                area_of_interest=pyproj.aoi.AreaOfInterest(
                    west_lon_degree=lon,
                    south_lat_degree=lat,
                    east_lon_degree=lon,
                    north_lat_degree=lat
                )
            )
            if not crs_info_list:
                raise ValueError("No UTM CRS found for the given coordinates")
            
            # Create CRS from the first matching CRSInfo
            crs_obj = pyproj.CRS.from_authority(crs_info_list[0].auth_name, crs_info_list[0].code)
            # Extract zone number from CRS name (e.g., "WGS 84 / UTM zone 10N" -> 10)
            import re
            zone_match = re.search(r'zone\s+(\d+)', crs_info_list[0].name, re.IGNORECASE)
            if zone_match:
                zone = int(zone_match.group(1))
            else:
                # Fallback: try to extract from authority code
                # EPSG codes for UTM: 32601-32660 (north), 32701-32760 (south)
                code = int(crs_info_list[0].code)
                if 32601 <= code <= 32660:  # Northern hemisphere
                    zone = code - 32600
                elif 32701 <= code <= 32760:  # Southern hemisphere
                    zone = code - 32700
                else:
                    raise ValueError("Could not extract valid UTM zone number from CRS")
            
            if zone < 1 or zone > 60:
                raise ValueError(f"Invalid UTM zone number: {zone}")
            
            return {
                "status": "success",
                "zone": zone,
                "message": "UTM zone retrieved successfully"
            }
        except Exception as e:
            logger.error(f"Error getting UTM zone: {str(e)}")
            raise ValueError(f"Failed to get UTM zone: {str(e)}")
  • MCP resource that lists 'get_utm_zone' among available CRS information operations, aiding tool discovery.
    @gis_mcp.resource("gis://crs/info")
    def get_crs_info_operations() -> Dict[str, List[str]]:
        """List available CRS information operations."""
        return {
            "operations": [
                "get_crs_info",
                "get_available_crs",
                "get_utm_zone",
                "get_utm_crs",
                "get_geocentric_crs"
            ]
        }
  • Type hints and docstring define the input schema (coordinates: List[float]) and output schema (Dict[str, Any]).
    def get_utm_zone(coordinates: List[float]) -> Dict[str, Any]:
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. The description only states the basic action ('Get UTM zone') without explaining what the tool returns, how it handles invalid coordinates, whether it has side effects, or any performance considerations. For a tool with no annotation coverage, this is inadequate.

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 extremely concise with a single sentence that directly states the tool's purpose. It's front-loaded with no wasted words, making it easy to parse quickly. Every word earns its place.

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

Completeness3/5

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

Given that there's an output schema (which should document the return value), the description doesn't need to explain output details. However, for a coordinate transformation tool with no annotations and minimal parameter documentation, the description should provide more context about usage scenarios, limitations, or relationship to sibling tools to be truly complete.

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 only mentions 'coordinates' without clarifying the expected format (e.g., [longitude, latitude] array, coordinate reference system, or valid ranges). With one undocumented parameter, the description adds minimal value beyond the schema's structural information.

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 with a specific verb ('Get') and resource ('UTM zone'), and it specifies the required input ('for given coordinates'). However, it doesn't distinguish this tool from potential siblings like 'get_utm_crs' or 'get_available_crs', which might have related functionality.

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 available (e.g., 'get_utm_crs', 'get_crs_info', 'project_geometry'), there's no indication of how this tool differs or when it's the appropriate choice. The description only states what it does, not when to use it.

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