Skip to main content
Glama

Get Elevation

get_elevation

Retrieve elevation data for specific geographic coordinates to analyze terrain height above sea level.

Instructions

Get elevation data for locations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationsYesList of locations to get elevation data for

Implementation Reference

  • The core handler function that fetches elevation data for given locations using the Google Maps Elevation API client.
    async getElevation(
        locations: Array<{ latitude: number; longitude: number }>
    ): Promise<ServiceResponse<ElevationResult[]>> {
        try {
            const locations_array = locations.map((loc) => {
                validateCoordinates(loc.latitude, loc.longitude);
                return { lat: loc.latitude, lng: loc.longitude };
            });
    
            const response = await this.client.elevation({
                params: {
                    key: config.googleMapsApiKey,
                    locations: locations_array,
                },
            });
    
            return {
                success: true,
                data: response.data.results.map((result) => ({
                    elevation: result.elevation,
                    location: result.location,
                    resolution: result.resolution,
                })),
            };
        } catch (error) {
            return handleError(error);
        }
    }
  • MCP tool registration for 'get_elevation', including input schema and a thin async handler that calls the PlacesSearcher service.
    server.registerTool(
        "get_elevation",
        {
            title: "Get Elevation",
            description: "Get elevation data for locations",
            inputSchema: ElevationSchema,
        },
        async (args) => {
            try {
                const result = await placesSearcher.getElevation(
                    args.locations
                );
                return {
                    content: [
                        { type: "text", text: JSON.stringify(result, null, 2) },
                    ],
                    isError: !result.success,
                };
            } catch (error) {
                const errorResponse = handleError(error);
                return {
                    content: [
                        {
                            type: "text",
                            text:
                                errorResponse.error ||
                                "An unknown error occurred",
                        },
                    ],
                    isError: true,
                };
            }
        }
    );
  • Zod input schema defining the expected structure for locations array in get_elevation tool.
    export const ElevationSchema = {
      locations: z.array(z.object({
        latitude: z.number(),
        longitude: z.number()
      })).describe("List of locations to get elevation data for")
    };
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It states what the tool does but reveals nothing about rate limits, authentication requirements, data sources, accuracy, units of measurement, or error handling. For a geospatial tool with no annotation coverage, this leaves significant behavioral questions unanswered.

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 a single, efficient sentence that communicates the core purpose without unnecessary words. It's appropriately sized for a straightforward data retrieval tool and gets directly to the point with zero wasted verbiage.

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 geospatial data tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what format the elevation data returns in, what units are used, whether there are limitations on location count, or how to interpret results. The agent would need to guess about important operational details.

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 the single parameter 'locations' well-documented in the schema as an array of latitude/longitude objects. The description adds no additional parameter semantics beyond what's already in the structured schema. 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 verb ('Get') and resource ('elevation data for locations'), making the purpose immediately understandable. It distinguishes itself from siblings like get_directions or get_geocode by focusing specifically on elevation. However, it doesn't specify whether this is for single or multiple locations, which could be more precise.

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. With siblings like get_geocode and get_reverse_geocode that handle location data differently, there's no indication of when elevation data is needed or what specific use cases this tool addresses. The agent must infer usage from the tool name alone.

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/BACH-AI-Tools/MCP-Google-Maps'

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