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
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | 关键词搜或者周边搜获取到的POI ID |
Implementation Reference
- build/index.js:403-444 (handler)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, }; }
- build/index.js:233-246 (schema)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); }
- build/streamable-http.js:182-227 (handler)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, };
- build/streamable-http.js:877-890 (schema)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"], }, };