Skip to main content
Glama
stadiamaps

Stadia Maps Location API MCP Server

route-overview

Get routing information between locations including travel time, distance, and route geometry for various travel methods.

Instructions

Get high-level routing information between two or more locations. Includes travel time, distance, and an encoded polyline of the route. The result is JSON.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationsYes
costingYesThe method of travel to use when routing (auto = automobile).
unitsYesThe unit to report distances in.

Implementation Reference

  • The handler function that executes the route-overview tool. It constructs a RouteRequest for the Stadia Maps Routing API, fetches the route, processes the summary to compute travel time and distance, extracts bounding box and polyline, and returns structured JSON content.
    export async function routeOverview({
      locations,
      costing,
      units,
    }: RouteOverviewParams): Promise<CallToolResult> {
      const req: RouteRequest = {
        locations,
        directionsType: "none",
        units,
        costing,
      };
    
      return handleToolError(
        async () => {
          const res = await routeApi.route({ routeRequest: req });
    
          if (instanceOfRouteResponse(res)) {
            if (res.trip.status != 0) {
              return {
                content: [
                  {
                    type: "text",
                    text: "No routes found.",
                  },
                ],
              };
            }
    
            const trip = res.trip;
            const summary = trip.summary;
            let travelTime: string;
            if (summary.time < 60) {
              travelTime = "less than a minute";
            } else {
              const minutes = Math.round(summary.time / 60);
              travelTime = `${minutes} minutes`;
            }
    
            const route = {
              distance: `${summary.length} ${units}`,
              time: travelTime,
              bbox_w_s_n_e: [
                summary.minLon,
                summary.minLat,
                summary.maxLon,
                summary.maxLat,
              ],
              polyline6: trip.legs[0].shape,
            };
    
            return {
              structuredContent: route,
              content: [
                {
                  type: "text",
                  text: JSON.stringify(route),
                },
              ],
            };
          } else {
            console.error("Unexpected response:", res);
    
            return {
              content: [
                {
                  type: "text",
                  text: "Unexpected response format.",
                },
              ],
            };
          }
        },
        {
          contextMessage: "Route calculation failed",
          enableLogging: true,
        },
      );
    }
  • src/index.ts:80-89 (registration)
    Registers the 'route-overview' tool with the MCP server, providing the tool name, description, input schema using Zod, and references the routeOverview handler function.
    server.tool(
      "route-overview",
      "Get high-level routing information between two or more locations. Includes travel time, distance, and an encoded polyline of the route. The result is JSON.",
      {
        locations: z.array(coordinatesSchema).min(2),
        costing: costingSchema,
        units: unitsSchema,
      },
      routeOverview,
    );
  • Defines the input schema for the route-overview tool using Zod schemas for locations (array of coordinates, min 2), costing model, and units.
    {
      locations: z.array(coordinatesSchema).min(2),
      costing: costingSchema,
      units: unitsSchema,
    },
  • Zod schema for coordinates used in route-overview locations.
    export const coordinatesSchema = z
      .object({
        lat: latitudeSchema,
        lon: longitudeSchema,
      })
      .describe("A geographic coordinate pair.");
  • Zod schema for costing model used in route-overview.
    export const costingSchema = z
      .nativeEnum(CostingModel)
      .describe("The method of travel to use when routing (auto = automobile).");
  • Zod schema for units used in route-overview.
    export const unitsSchema = z
      .nativeEnum(DistanceUnit)
      .describe("The unit to report distances in.");
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 mentions the output format ('JSON') but lacks critical details: whether this is a read-only operation, if it requires authentication, rate limits, error conditions, or what happens with invalid locations. For a routing tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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 efficiently structured in two sentences: the first states purpose and key outputs, the second specifies the result format. It's front-loaded with essential information and has no wasted words, though it could be slightly more comprehensive given the lack of annotations.

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?

For a routing tool with 3 required parameters, no annotations, and no output schema, the description is minimally adequate. It covers basic purpose and output format but lacks behavioral context, parameter guidance, and error handling. The absence of output schema means the description should ideally explain return values more thoroughly.

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 67% (2 of 3 parameters have descriptions). The description adds minimal value beyond the schema—it implies 'locations' parameter usage but doesn't explain parameter interactions or provide examples. With moderate schema coverage, the baseline of 3 is appropriate as the description doesn't significantly compensate for the coverage gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Get high-level routing information'), resource ('between two or more locations'), and output details ('travel time, distance, and an encoded polyline of the route'). It distinguishes itself from siblings like geocode or isochrone by focusing on routing between multiple points rather than address conversion or area-based calculations.

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 isochrone (for travel-time areas) or static-map (for visual route display), nor does it specify prerequisites or exclusions. Usage context is implied but not explicitly stated.

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/stadiamaps/stadiamaps-mcp-server-ts'

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