maps_around_search
Search for nearby points of interest by entering keywords, location coordinates, and radius to find businesses, landmarks, and services around any specified area.
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)The core handler function that executes the maps_around_search tool by calling the AMap API for places around a location and returning formatted POI data.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)Defines the tool schema 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)Registers the tool handler in the switch statement for CallToolRequestSchema, dispatching to handleAroundSearch.case "maps_around_search": { const { location, radius, keywords } = request.params.arguments; return await handleAroundSearch(location, radius, keywords); }
- build/index.js:247-260 (registration)Includes the maps_around_search tool in the MAPS_TOOLS array returned by ListToolsRequest handler.const MAPS_TOOLS = [ REGEOCODE_TOOL, GEO_TOOL, IP_LOCATION_TOOL, WEATHER_TOOL, SEARCH_DETAIL_TOOL, BICYCLING_TOOL, WALKING_TOOL, DRIVING_TOOl, TRANSIT_INTEGRATED_TOOL, DISTANCE_TOOL, TEXT_SEARCH_TOOL, AROUND_SEARCH_TOOL, ];