Skip to main content
Glama
masx200

AMap Maps MCP Server

by masx200

maps_search_detail

Retrieve detailed information about specific points of interest using their ID from search results, providing comprehensive location data and business details.

Instructions

查询关键词搜或者周边搜获取到的POI ID的详细信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes关键词搜或者周边搜获取到的POI ID

Implementation Reference

  • Handler function that implements the core logic of 'maps_search_detail' tool by querying Amap place detail API with POI ID and formatting the response.
    async function handleSearchDetail(id) { const url = new URL("https://restapi.amap.com/v3/place/detail"); url.searchParams.append("id", id); 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: `Get poi detail failed: ${data.info || data.infocode}`, }], isError: true, }; } let poi = data.pois[0]; return { content: [{ type: "text", text: JSON.stringify( { id: poi.id, name: poi.name, location: poi.location, address: poi.address, business_area: poi.business_area, city: poi.cityname, type: poi.type, alias: poi.alias, photos: poi.photos && poi.photos.length > 0 ? poi.photos[0] : undefined, ...poi.biz_ext, }, null, 2, ), }], isError: false, }; }
  • Schema definition for the 'maps_search_detail' tool, including input schema requiring 'id' parameter.
    const SEARCH_DETAIL_TOOL = { name: "maps_search_detail", description: "查询关键词搜或者周边搜获取到的POI ID的详细信息", inputSchema: { type: "object", properties: { id: { type: "string", description: "关键词搜或者周边搜获取到的POI ID", }, }, required: ["id"], }, };
  • build/index.js:870-873 (registration)
    Registration of the tool handler in the CallToolRequestSchema switch statement, dispatching calls to handleSearchDetail.
    case "maps_search_detail": { const { id } = request.params.arguments; return await handleSearchDetail(id); }
  • Identical handler function for 'maps_search_detail' in the HTTP server variant.
    async function handleSearchDetail(id) { const AMAP_MAPS_API_KEY = getApiKey(); const url = new URL("https://restapi.amap.com/v3/place/detail"); url.searchParams.append("id", id); 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: `Get poi detail failed: ${data.info || data.infocode}`, }, ], isError: true, }; } let poi = data.pois[0]; return { content: [ { type: "text", text: JSON.stringify( { id: poi.id, name: poi.name, location: poi.location, address: poi.address, business_area: poi.business_area, city: poi.cityname, type: poi.type, alias: poi.alias, photos: poi.photos && poi.photos.length > 0 ? poi.photos[0] : undefined, ...poi.biz_ext, }, null, 2, ), }, ], isError: false, };
  • Schema definition for the 'maps_search_detail' tool in the HTTP server variant.
    const SEARCH_DETAIL_TOOL = { name: "maps_search_detail", description: "查询关键词搜或者周边搜获取到的POI ID的详细信息", inputSchema: { type: "object", properties: { id: { type: "string", description: "关键词搜或者周边搜获取到的POI ID", }, }, required: ["id"], }, };

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