maps_search_detail
Retrieve detailed information about a specific location by providing its POI ID from AMap Maps searches.
Instructions
查询关键词搜或者周边搜获取到的POI ID的详细信息
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | 关键词搜或者周边搜获取到的POI ID |
Implementation Reference
- build/index.js:403-444 (handler)The handleSearchDetail function fetches detailed POI information from the Amap API using the provided ID and formats 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)Tool schema definition for maps_search_detail, specifying the input schema with required '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)Tool handler registration in the switch statement of the CallToolRequestSchema handler.case "maps_search_detail": { const { id } = request.params.arguments; return await handleSearchDetail(id); }
- build/streamable-http.js:182-227 (handler)Duplicate implementation of the handleSearchDetail function in the HTTP server version.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)Duplicate tool schema definition in the HTTP server version.const SEARCH_DETAIL_TOOL = { name: "maps_search_detail", description: "查询关键词搜或者周边搜获取到的POI ID的详细信息", inputSchema: { type: "object", properties: { id: { type: "string", description: "关键词搜或者周边搜获取到的POI ID", }, }, required: ["id"], }, };