Skip to main content
Glama
cablate

MCP Google Map Server

maps_reverse_geocode

Convert latitude and longitude coordinates into precise addresses using Google Maps API integration, enabling accurate location identification.

Instructions

將座標轉換為地址

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latitudeYes緯度
longitudeYes經度

Implementation Reference

  • Main handler function for the maps_reverse_geocode tool. It instantiates PlacesSearcher with the current API key and calls its reverseGeocode method with the provided latitude and longitude.
    async function ACTION(params: any): Promise<{ content: any[]; isError?: boolean }> {
      try {
        // Create a new PlacesSearcher instance with the current request's API key
        const apiKey = getCurrentApiKey();
        const placesSearcher = new PlacesSearcher(apiKey);
        const result = await placesSearcher.reverseGeocode(params.latitude, params.longitude);
    
        if (!result.success) {
          return {
            content: [{ type: "text", text: result.error || "Failed to reverse geocode coordinates" }],
            isError: true,
          };
        }
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result.data, null, 2),
            },
          ],
          isError: false,
        };
      } catch (error: any) {
        const errorMessage = error instanceof Error ? error.message : JSON.stringify(error);
        return {
          isError: true,
          content: [{ type: "text", text: `Error reverse geocoding: ${errorMessage}` }],
        };
      }
    }
  • Zod schema definition for input parameters (latitude and longitude) and the inferred TypeScript type.
    const SCHEMA = {
      latitude: z.number().describe("Latitude coordinate"),
      longitude: z.number().describe("Longitude coordinate"),
    };
    
    export type ReverseGeocodeParams = z.infer<z.ZodObject<typeof SCHEMA>>;
  • src/config.ts:42-46 (registration)
    Registration of the maps_reverse_geocode tool in the server configuration, referencing the exported constants and ACTION from reverseGeocode.ts.
      name: ReverseGeocode.NAME,
      description: ReverseGeocode.DESCRIPTION,
      schema: ReverseGeocode.SCHEMA,
      action: (params: ReverseGeocodeParams) => ReverseGeocode.ACTION(params),
    },
  • Supporting method in PlacesSearcher class that calls the underlying GoogleMapsTools reverseGeocode and handles response/error formatting.
    async reverseGeocode(latitude: number, longitude: number): Promise<ReverseGeocodeResponse> {
      try {
        const result = await this.mapsTools.reverseGeocode(latitude, longitude);
    
        return {
          success: true,
          data: result,
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : "An error occurred during reverse geocoding",
        };
      }
    }
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. While '將座標轉換為地址' implies a read-only lookup operation, it doesn't disclose any behavioral traits such as rate limits, authentication requirements, error conditions, or what happens with invalid coordinates. 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 extremely concise and front-loaded with a single sentence that directly states the tool's function. There is zero wasted language, and every word earns its place by conveying essential information.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what the return value looks like (e.g., address format, possible fields), error handling, or any behavioral context. For a tool with 2 parameters and no structured output documentation, the description should provide more contextual information.

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%, with both parameters ('latitude' and 'longitude') clearly documented in the schema. The description doesn't add any parameter semantics beyond what the schema provides (e.g., coordinate formats, valid ranges, or examples). Baseline 3 is appropriate when the schema does the heavy lifting.

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: converting coordinates to an address. It uses a specific verb ('轉換為' meaning 'convert to') and identifies the resource (coordinates to address). However, it doesn't differentiate from sibling tools like 'maps_geocode' which likely performs the inverse operation.

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 sibling tools like 'maps_geocode' (likely address to coordinates), 'get_place_details', or 'search_nearby', nor does it specify any prerequisites, constraints, or appropriate contexts for use.

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

Related 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/cablate/mcp-google-map'

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