Skip to main content
Glama
masx200

AMap Maps MCP Server

by masx200

maps_text_search

Search for points of interest using keywords to find locations like restaurants, gas stations, or other facilities in specified cities.

Instructions

关键词搜,根据用户传入关键词,搜索出相关的POI

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordsYes搜索关键词
cityNo查询城市
typesNoPOI类型,比如加油站

Implementation Reference

  • Core handler function for maps_text_search tool. Makes API call to Amap's place/text endpoint with keywords, city, citylimit, processes response including suggestions and POIs, handles errors, and returns formatted content.
    async function handleTextSearch(keywords, city = "", citylimit = "false") { const url = new URL("https://restapi.amap.com/v3/place/text"); url.searchParams.append("key", AMAP_MAPS_API_KEY); url.searchParams.append("keywords", keywords); url.searchParams.append("city", city); url.searchParams.append("citylimit", citylimit); 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: `Text Search failed: ${data.info || data.infocode}`, }], isError: true, }; } let resciytes = data.suggestion && data.suggestion.ciytes ? data.suggestion.ciytes.map((city) => { return { name: city.name, }; }) : []; return { content: [{ type: "text", text: JSON.stringify( { suggestion: { keywords: data.suggestion.keywords, ciytes: resciytes, }, 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, }; }
  • Schema definition for the maps_text_search tool, including name, description, inputSchema with properties keywords (required), city, types.
    const TEXT_SEARCH_TOOL = { name: "maps_text_search", description: "关键词搜,根据用户传入关键词,搜索出相关的POI", inputSchema: { type: "object", properties: { keywords: { type: "string", description: "搜索关键词", }, city: { type: "string", description: "查询城市", }, types: { type: "string", description: "POI类型,比如加油站", }, }, required: ["keywords"], }, };
  • build/index.js:848-850 (registration)
    Registration via ListToolsRequestSchema handler that returns the list of tools including maps_text_search.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: MAPS_TOOLS, }));
  • build/index.js:894-897 (registration)
    Dispatch registration in the CallToolRequestSchema switch statement that calls the handler for maps_text_search.
    case "maps_text_search": { const { keywords, city, citylimit } = request.params.arguments; return await handleTextSearch(keywords, city, citylimit); }
  • Identical schema definition in the HTTP server version.
    const TEXT_SEARCH_TOOL = { name: "maps_text_search", description: "关键词搜,根据用户传入关键词,搜索出相关的POI", inputSchema: { type: "object", properties: { keywords: { type: "string", description: "搜索关键词", }, city: { type: "string", description: "查询城市", }, types: { type: "string", description: "POI类型,比如加油站", }, }, required: ["keywords"], },

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