Skip to main content
Glama
ronantakizawa

GIS Data Conversion MCP

coordinates_to_location

Convert latitude and longitude coordinates into human-readable location names using reverse geocoding to identify places on maps.

Instructions

Convert latitude/longitude coordinates to location name using reverse geocoding

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latitudeYesLatitude coordinate
longitudeYesLongitude coordinate

Implementation Reference

  • The handler function for 'coordinates_to_location' that performs reverse geocoding via HTTPS request to Nominatim OSM service, parsing the JSON response to return location details including display_name, address, type, etc.
    async coordinatesToLocation(args: any): Promise<ToolResponse> {
      const { latitude, longitude } = args;
      
      if (latitude === undefined || longitude === undefined) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Missing required parameters: latitude, longitude'
        );
      }
      
      try {
        console.error(`[Converting] Coordinates (${latitude}, ${longitude}) to location name`);
        
        // Using Nominatim OSM service (free, but has usage limitations)
        const url = `https://nominatim.openstreetmap.org/reverse?format=json&lat=${latitude}&lon=${longitude}`;
        
        return new Promise<ToolResponse>((resolve, reject) => {
          // Use the imported https module directly
          const req = https.request(url, {
            method: 'GET',
            headers: {
              'User-Agent': 'GisFormatMcpServer/1.0'
            }
          }, (res) => {
            if (res.statusCode !== 200) {
              reject(new Error(`Geocoding service returned ${res.statusCode}: ${res.statusMessage}`));
              return;
            }
            
            let data = '';
            res.on('data', (chunk) => {
              data += chunk;
            });
            
            res.on('end', () => {
              try {
                const parsedData = JSON.parse(data);
                
                // Always return detailed format
                const result = {
                  displayName: parsedData.display_name,
                  address: parsedData.address,
                  type: parsedData.type,
                  osmId: parsedData.osm_id,
                  osmType: parsedData.osm_type,
                  category: parsedData.category
                };
                
                resolve(this.formatToolResponse(JSON.stringify(result, null, 2)));
              } catch (error) {
                reject(new Error(`Failed to parse geocoding response: ${error instanceof Error ? error.message : String(error)}`));
              }
            });
          });
          
          req.on('error', (error) => {
            reject(new Error(`Geocoding request failed: ${error.message}`));
          });
          
          req.end();
        });
      } catch (error) {
        console.error('[Error] Coordinates to location conversion failed:', error);
        throw new McpError(
          ErrorCode.InternalError,
          `Coordinates to location conversion failed: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • Input schema definition for the coordinates_to_location tool, specifying latitude and longitude as required number properties.
    inputSchema: {
      type: 'object',
      properties: {
        latitude: {
          type: 'number',
          description: 'Latitude coordinate',
        },
        longitude: {
          type: 'number',
          description: 'Longitude coordinate',
        }
      },
      required: ['latitude', 'longitude'],
    },
  • src/index.ts:255-272 (registration)
    Registration of the coordinates_to_location tool in the ListTools response, including name, description, and input schema.
    {
      name: 'coordinates_to_location',
      description: 'Convert latitude/longitude coordinates to location name using reverse geocoding',
      inputSchema: {
        type: 'object',
        properties: {
          latitude: {
            type: 'number',
            description: 'Latitude coordinate',
          },
          longitude: {
            type: 'number',
            description: 'Longitude coordinate',
          }
        },
        required: ['latitude', 'longitude'],
      },
    }
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 states the tool performs reverse geocoding but doesn't describe what 'location name' entails (e.g., address, city, country), potential accuracy issues, rate limits, or error handling. This leaves 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.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without any wasted words. It is appropriately sized and front-loaded, making it easy to understand at a glance.

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 geocoding (which can involve accuracy, data sources, and output formats), the description is incomplete. With no annotations and no output schema, it fails to explain what 'location name' means in the return value or any behavioral nuances, leaving the agent with insufficient context for reliable use.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents both parameters (latitude and longitude) adequately. The description adds no additional meaning beyond what the schema provides, such as coordinate format (e.g., decimal degrees) or valid ranges, which aligns with the baseline score when schema coverage is high.

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 as converting coordinates to a location name using reverse geocoding, which is a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools, which are all format converters rather than geocoding tools, so it misses the opportunity to clarify this distinction.

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. It doesn't mention prerequisites, limitations, or context for usage, such as when reverse geocoding is appropriate compared to other geospatial operations available in the sibling tools.

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/ronantakizawa/gis-dataconvertersion-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server