Skip to main content
Glama
masx200

AMap Maps MCP Server

by masx200

maps_regeocode

Convert latitude-longitude coordinates into readable address information using AMap's reverse geocoding service to identify administrative divisions and locations.

Instructions

将一个高德经纬度坐标转换为行政区划地址信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationYes经纬度

Implementation Reference

  • Handler function that performs reverse geocoding by calling the AMap regeocode API with the given location (longitude,latitude), extracts province, city, district and returns them as JSON.
    async function handleReGeocode(location) { const url = new URL("https://restapi.amap.com/v3/geocode/regeo"); url.searchParams.append("location", location); url.searchParams.append("key", AMAP_MAPS_API_KEY); url.searchParams.append("source", "ts_mcp"); const response = await fetch(url.toString()); const data = await response.json(); if (data.status !== "1") { return { content: [{ type: "text", text: `RGeocoding failed: ${data.info || data.infocode}`, }], isError: true, }; } return { content: [{ type: "text", text: JSON.stringify( { provice: data.regeocode.addressComponent.province, city: data.regeocode.addressComponent.city, district: data.regeocode.addressComponent.district, }, null, 2, ), }], isError: false, }; }
  • Schema definition for the maps_regeocode tool, specifying input as an object with required 'location' string (coordinates).
    const REGEOCODE_TOOL = { name: "maps_regeocode", description: "将一个高德经纬度坐标转换为行政区划地址信息", inputSchema: { type: "object", properties: { location: { type: "string", description: "经纬度", }, }, required: ["location"], }, };
  • build/index.js:854-857 (registration)
    Registration of the maps_regeocode handler in the CallToolRequestHandler switch statement.
    case "maps_regeocode": { const { location } = request.params.arguments; return await handleReGeocode(location); }
  • build/index.js:848-850 (registration)
    Registration of tool list handler which includes the maps_regeocode schema via MAPS_TOOLS array.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: MAPS_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/masx200/amap-maps-mcp-server'

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