Skip to main content
Glama
danilat
by danilat

geolocation-from-address

Convert Zaragoza addresses into precise latitude and longitude coordinates to locate bus stops, tram stations, and Bizi stations.

Instructions

Get the geolocation (latitude and longitude) from an address and the formatted address that was found, only for Zaragoza. Can be used to find a bus stops, tram stations or bizi stations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYes

Implementation Reference

  • Handler function that uses Google Maps Geocoding API to convert an address (appended with 'Zaragoza, Spain') to latitude, longitude, confidence, and formatted address. Requires GOOGLE_MAPS_API_KEY env var. Returns JSON string of location or error message.
    async ({ address }) => {
      const GOOGLE_MAPS_API_KEY = process.env.GOOGLE_MAPS_API_KEY;
      if (!GOOGLE_MAPS_API_KEY) {
        return {
          content: [
            {
              type: "text",
              text: "You should configure the GOOGLE_MAPS_API_KEY for MCP DNDzgz",
            },
          ],
        };
      }
    
      const encodedAddress = encodeURIComponent(`${address}, Zaragoza, Spain`);
      const url = `https://maps.googleapis.com/maps/api/geocode/json?address=${encodedAddress}&key=${GOOGLE_MAPS_API_KEY}`;
    
      const response = await fetch(url);
      if (response.ok) {
        const data = await response.json();
        if (data.status === "OK" && data.results.length > 0) {
          const location = data.results[0].geometry.location;
          location.confindence = data.results[0].geometry.location_type;
          location.formatted_address = data.results[0].formatted_address;
          return {
            content: [{ type: "text", text: JSON.stringify(location) }],
          };
        } else {
          return {
            content: [
              {
                type: "text",
                text: `No geolocation found for the address: ${address}`,
              },
            ],
          };
        }
      } else {
        return {
          content: [
            {
              type: "text",
              text: `Failed to fetch geolocation for the address: ${address}`,
            },
          ],
        };
      }
    }
  • Input schema defined with Zod: requires a single 'address' parameter as string.
    {
      address: z.string(),
    },
  • index.js:200-253 (registration)
    Registration of the 'geolocation-from-address' tool using server.tool(), including name, description, input schema, and inline handler function.
    server.tool(
      "geolocation-from-address",
      "Get the geolocation (latitude and longitude) from an address and the formatted address that was found, only for Zaragoza. Can be used to find a bus stops, tram stations or bizi stations",
      {
        address: z.string(),
      },
      async ({ address }) => {
        const GOOGLE_MAPS_API_KEY = process.env.GOOGLE_MAPS_API_KEY;
        if (!GOOGLE_MAPS_API_KEY) {
          return {
            content: [
              {
                type: "text",
                text: "You should configure the GOOGLE_MAPS_API_KEY for MCP DNDzgz",
              },
            ],
          };
        }
    
        const encodedAddress = encodeURIComponent(`${address}, Zaragoza, Spain`);
        const url = `https://maps.googleapis.com/maps/api/geocode/json?address=${encodedAddress}&key=${GOOGLE_MAPS_API_KEY}`;
    
        const response = await fetch(url);
        if (response.ok) {
          const data = await response.json();
          if (data.status === "OK" && data.results.length > 0) {
            const location = data.results[0].geometry.location;
            location.confindence = data.results[0].geometry.location_type;
            location.formatted_address = data.results[0].formatted_address;
            return {
              content: [{ type: "text", text: JSON.stringify(location) }],
            };
          } else {
            return {
              content: [
                {
                  type: "text",
                  text: `No geolocation found for the address: ${address}`,
                },
              ],
            };
          }
        } else {
          return {
            content: [
              {
                type: "text",
                text: `Failed to fetch geolocation for the address: ${address}`,
              },
            ],
          };
        }
      }
    );  
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 mentions the tool returns 'geolocation (latitude and longitude)' and 'formatted address,' but doesn't cover other important aspects like error handling, rate limits, authentication needs, or what happens with invalid addresses. For a tool with zero annotation coverage, 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 appropriately sized and front-loaded: the first sentence states the core purpose, and the second adds usage context. Every sentence earns its place with no wasted words, making it efficient and easy to parse.

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 complexity (simple geocoding with 1 parameter), no annotations, and no output schema, the description is somewhat complete but has gaps. It covers purpose and usage but lacks details on behavior, parameters, and return values. For a tool with no structured support, this is adequate but not fully comprehensive.

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 input schema has 1 parameter with 0% description coverage, so the description must compensate. It mentions 'address' as the input but doesn't add details beyond what's implied (e.g., format, examples, or constraints like 'only for Zaragoza' addresses). This provides minimal semantic value, aligning with the baseline when schema coverage is low but not fully compensating.

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: 'Get the geolocation (latitude and longitude) from an address and the formatted address that was found, only for Zaragoza.' It specifies the verb ('Get'), resource ('geolocation'), and scope ('only for Zaragoza'). However, it doesn't explicitly differentiate from sibling tools like 'google-maps-link' or other geospatial tools, which would require a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for usage: 'only for Zaragoza' and 'Can be used to find a bus stops, tram stations or bizi stations.' This gives practical guidance on when to use it. However, it doesn't explicitly state when not to use it or name alternatives (e.g., 'google-maps-link' for broader geocoding), which would be needed for a score of 5.

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/danilat/mcp-dndzgz'

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