Skip to main content
Glama
masx200

AMap Maps MCP Server

by masx200

maps_regeocode

Convert geographic coordinates into readable address information by translating latitude and longitude into administrative division details and street addresses.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationYes经纬度

Implementation Reference

  • Handler function that executes the maps_regeocode tool: calls Amap reverse geocoding API with location, parses response to extract province, city, district.
    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, }; }
  • Tool schema definition including name, description, and input schema requiring 'location' string.
    const REGEOCODE_TOOL = { name: "maps_regeocode", description: "将一个高德经纬度坐标转换为行政区划地址信息", inputSchema: { type: "object", properties: { location: { type: "string", description: "经纬度", }, }, required: ["location"], }, };
  • build/index.js:854-857 (registration)
    Registration in the tool call switch statement dispatching to handleReGeocode.
    case "maps_regeocode": { const { location } = request.params.arguments; return await handleReGeocode(location); }
  • Handler function that executes the maps_regeocode tool in the HTTP server version: calls Amap reverse geocoding API.
    async function handleReGeocode(location) { const AMAP_MAPS_API_KEY = getApiKey(); 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, };
  • Tool schema definition including name, description, and input schema requiring 'location' string in HTTP server.
    name: "maps_regeocode", description: "将一个高德经纬度坐标转换为行政区划地址信息", inputSchema: { type: "object", properties: { location: { type: "string", description: "经纬度", }, }, required: ["location"], }, };

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