Skip to main content
Glama
masx200

AMap Maps MCP Server

by masx200

maps_text_search

Search for points of interest (POI) in Chinese locations using keywords, city filters, and POI types to find relevant geographic data.

Instructions

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

Input Schema

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

Implementation Reference

  • Core handler function for 'maps_text_search' that queries the Amap API for POI based on keywords and formats the response.
    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, }; }
  • Input schema definition for the 'maps_text_search' tool.
    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:894-897 (registration)
    Dispatcher case registering and invoking the handler for 'maps_text_search' in the CallToolRequestSchema.
    case "maps_text_search": { const { keywords, city, citylimit } = request.params.arguments; return await handleTextSearch(keywords, city, citylimit); }
  • Core handler function for 'maps_text_search' in the HTTP server version.
    async function handleTextSearch(keywords, city = "", citylimit = "false") { const AMAP_MAPS_API_KEY = getApiKey(); 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, }; }
  • Input schema definition for the 'maps_text_search' tool in the HTTP server.
    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