Skip to main content
Glama
masx200

AMap Maps MCP Server

by masx200

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
NameRequiredDescriptionDefault
idYes关键词搜或者周边搜获取到的POI ID

Implementation Reference

  • 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, }; }
  • 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); }
  • 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, };
  • 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"], }, };

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