Skip to main content
Glama
cablate

MCP Google Map Server

maps_directions

Generate precise directions between two locations using specified travel modes like driving, walking, bicycling, or transit. Ideal for planning routes with accurate, real-time guidance.

Instructions

獲取兩點之間的路線指引

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
destinationYes終點地址或座標
modeNo交通模式driving
originYes起點地址或座標

Implementation Reference

  • The ACTION function that executes the core logic of the 'maps_directions' tool. It uses PlacesSearcher to fetch directions between origin and destination, handles errors, and returns formatted content.
    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.getDirections(
          params.origin,
          params.destination,
          params.mode,
          params.departure_time,
          params.arrival_time
        );
    
        if (!result.success) {
          return {
            content: [{ type: "text", text: result.error || "Failed to get directions" }],
            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 getting directions: ${errorMessage}` }],
        };
      }
  • Zod schema defining the input parameters for the maps_directions tool.
    const SCHEMA = {
      origin: z.string().describe("Starting point address or coordinates"),
      destination: z.string().describe("Destination address or coordinates"),
      mode: z.enum(["driving", "walking", "bicycling", "transit"]).default("driving").describe("Travel mode for directions"),
      departure_time: z.string().optional().describe("Departure time (ISO string format)"),
      arrival_time: z.string().optional().describe("Arrival time (ISO string format)"),
    };
  • src/config.ts:53-58 (registration)
    Registration of the 'maps_directions' tool in the server configuration array, linking to the Directions module.
    {
      name: Directions.NAME,
      description: Directions.DESCRIPTION,
      schema: Directions.SCHEMA,
      action: (params: DirectionsParams) => Directions.ACTION(params),
    },
  • src/config.ts:9-9 (registration)
    Import statement for the Directions tool module used in registration.
    import { Directions, DirectionsParams } from "./tools/maps/directions.js";
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe how it behaves: no information about rate limits, authentication needs, response format, error conditions, or whether this is a read-only operation. The description is minimal and lacks operational context.

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 - a single sentence that directly states the tool's purpose. There's zero wasted language, and it's front-loaded with the core functionality. Every word earns its place in this minimal description.

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?

For a route planning tool with 3 parameters and no output schema, the description is incomplete. It doesn't explain what the tool returns (route steps, duration, distance, etc.), doesn't mention common use cases or limitations, and provides no behavioral context. With no annotations and no output schema, users must guess about the tool's behavior and results.

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 all three parameters thoroughly. The description doesn't add any parameter semantics beyond what's in the schema - it doesn't explain format expectations, coordinate systems, or provide usage examples. Baseline 3 is appropriate when 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 as '獲取兩點之間的路線指引' (get route directions between two points), which specifies the verb (get) and resource (route directions). It distinguishes from siblings like maps_distance_matrix (distance calculations) and maps_geocode (address conversion), but doesn't explicitly differentiate from potential route-planning alternatives.

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 like maps_distance_matrix (for distance/time only) or search_nearby (for points of interest). It doesn't mention prerequisites, limitations, or typical use cases beyond the basic functionality.

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