Skip to main content
Glama

geocode

Convert location names to geographic coordinates using France's Géoplateforme autocompletion service for spatial data integration.

Instructions

Renvoie les coordonnées (lon,lat) d'un lieu en complétant les informations (source : Géoplateforme (service d'autocomplétion)).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesLe texte devant être completé et géocodé

Implementation Reference

  • The execute method implementing the core logic of the 'geocode' tool by calling the geocode helper function with the input text.
    async execute(input: GeocodeInput) {
      logger.info(`geocode(${input.text})...`);
      return geocode(input.text);
    }
  • Input schema definition including TypeScript interface GeocodeInput and Zod validation schema for the 'text' parameter.
    interface GeocodeInput {
      text: string;
    }
    
    class GeocodeTool extends MCPTool<GeocodeInput> {
      name = "geocode";
      description = `Renvoie les coordonnées (lon,lat) d'un lieu en complétant les informations (source : ${GEOCODE_SOURCE}).`;
    
      schema = {
        text: {
          type: z.string(),
          description: "Le texte devant être completé et géocodé",
        },
      };
  • The GeocodeTool class registration, extending MCPTool, setting name to 'geocode', description, schema, and execute handler.
    class GeocodeTool extends MCPTool<GeocodeInput> {
      name = "geocode";
      description = `Renvoie les coordonnées (lon,lat) d'un lieu en complétant les informations (source : ${GEOCODE_SOURCE}).`;
    
      schema = {
        text: {
          type: z.string(),
          description: "Le texte devant être completé et géocodé",
        },
      };
    
      async execute(input: GeocodeInput) {
        logger.info(`geocode(${input.text})...`);
        return geocode(input.text);
      }
    }
    
    export default GeocodeTool;
  • Helper function geocode that performs the actual geocoding by querying the Géoplateforme API and transforming results to lon/lat/fulltext format.
    export async function geocode(text) {
        logger.info(`geocode(${JSON.stringify(text)})...`);
        
        const url = 'https://data.geopf.fr/geocodage/completion/?' + new URLSearchParams({
          text: text,
          maximumResponses: 3
        }).toString();
    
        const json = await fetchJSON(url);
        return json.results.map((item)=>{return {
          lon: item.x,
          lat: item.y,
          fulltext: item.fulltext
        }});
    }
  • Constant GEOCODE_SOURCE used in the tool description to credit the data source.
    export const GEOCODE_SOURCE = "Géoplateforme (service d'autocomplétion)";
Behavior2/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. It states the tool returns coordinates and uses an autocompletion service, but doesn't mention important behavioral traits like rate limits, authentication requirements, error handling, or whether it's a read-only operation. For a geocoding tool with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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 appropriately concise with a single sentence that communicates the core purpose. It's front-loaded with the main action (returns coordinates) and includes useful context about the data source. While efficient, it could be slightly more structured by separating purpose from implementation details.

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 the tool's moderate complexity (geocoding with autocompletion), no annotations, no output schema, and 100% schema coverage, the description is minimally adequate. It covers what the tool does and the data source, but lacks details about return format, error conditions, or behavioral constraints that would be helpful for an AI agent to use it correctly.

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?

The description doesn't explicitly mention the 'text' parameter, but it implies its purpose by stating the tool 'completes information' for a place. With 100% schema description coverage (the schema fully documents the parameter), the baseline is 3. The description adds minimal value beyond what's already in the schema, maintaining the adequate baseline.

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: 'Renvoie les coordonnées (lon,lat) d'un lieu en complétant les informations' (Returns coordinates of a place by completing information). It specifies the verb (returns coordinates), resource (place), and action (completing information). However, it doesn't explicitly differentiate from sibling tools like 'altitude' or 'cadastre', 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 minimal usage guidance. It mentions the data source (Géoplateforme autocompletion service) but doesn't explain when to use this tool versus alternatives like 'altitude' (which might provide elevation data) or 'cadastre' (which might provide cadastral information). No explicit when/when-not instructions or prerequisites are included.

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/ignfab/geocontext'

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