maps_around_search
Search for points of interest within a specified radius around any geographic location using keywords to find nearby businesses, landmarks, and services.
Instructions
周边搜,根据用户传入关键词以及坐标location,搜索出radius半径范围的POI
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keywords | No | 搜索关键词 | |
| location | Yes | 中心点经度纬度 | |
| radius | No | 搜索半径 |
Implementation Reference
- build/index.js:796-837 (handler)Handler function that implements the core logic for 'maps_around_search' tool by querying the Amap place/around API and processing the POI results.async function handleAroundSearch(location, radius = "1000", keywords = "") { const url = new URL("https://restapi.amap.com/v3/place/around"); url.searchParams.append("key", AMAP_MAPS_API_KEY); url.searchParams.append("location", location); url.searchParams.append("radius", radius); url.searchParams.append("keywords", keywords); 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: `Around Search failed: ${data.info || data.infocode}`, }], isError: true, }; } return { content: [{ type: "text", text: JSON.stringify( { pois: data.pois.map((poi) => { return { id: poi.id, name: poi.name, address: poi.address, typecode: poi.typecode, photos: poi.photos && poi.photos.length > 0 ? poi.photos[0] : undefined, }; }), }, null, 2, ), }], isError: false, }; }
- build/index.js:210-232 (schema)Tool definition including name, description, and input schema for 'maps_around_search'.const AROUND_SEARCH_TOOL = { name: "maps_around_search", description: "周边搜,根据用户传入关键词以及坐标location,搜索出radius半径范围的POI", inputSchema: { type: "object", properties: { keywords: { type: "string", description: "搜索关键词", }, location: { type: "string", description: "中心点经度纬度", }, radius: { type: "string", description: "搜索半径", }, }, required: ["location"], }, };
- build/index.js:898-901 (registration)Registration of the tool handler in the CallToolRequestSchema switch statement.case "maps_around_search": { const { location, radius, keywords } = request.params.arguments; return await handleAroundSearch(location, radius, keywords); }
- build/index.js:848-850 (registration)Registration for listing tools, which includes 'maps_around_search' via MAPS_TOOLS array.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: MAPS_TOOLS, }));
- build/streamable-http.js:612-658 (handler)Duplicate handler function in the HTTP server variant for 'maps_around_search' tool.async function handleAroundSearch(location, radius = "1000", keywords = "") { const AMAP_MAPS_API_KEY = getApiKey(); const url = new URL("https://restapi.amap.com/v3/place/around"); url.searchParams.append("key", AMAP_MAPS_API_KEY); url.searchParams.append("location", location); url.searchParams.append("radius", radius); url.searchParams.append("keywords", keywords); 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: `Around Search failed: ${data.info || data.infocode}`, }, ], isError: true, }; } return { content: [ { type: "text", text: JSON.stringify( { pois: data.pois.map((poi) => { return { id: poi.id, name: poi.name, address: poi.address, typecode: poi.typecode, photos: poi.photos && poi.photos.length > 0 ? poi.photos[0] : undefined, }; }), }, null, 2, ), }, ], isError: false, }; }