Skip to main content
Glama
masx200

AMap Maps MCP Server

by masx200

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
NameRequiredDescriptionDefault
keywordsNo搜索关键词
locationYes中心点经度纬度
radiusNo搜索半径

Implementation Reference

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

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