Skip to main content
Glama

maps_text_search

Search for points of interest using keywords to find locations, addresses, and related information on maps.

Instructions

关键词搜索 API 根据用户输入的关键字进行 POI 搜索,并返回相关的信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordsYes
cityNo
citylimitNofalse

Implementation Reference

  • The handler function for the 'maps_text_search' tool. It performs a text-based POI search using the Amap Maps API v3/place/text endpoint, taking keywords, optional city, and citylimit parameters. It processes the response to return suggestions and POIs or errors.
    @mcp.tool() def maps_text_search(keywords: str, city: str = "", citylimit: str = "false") -> Dict[str, Any]: """关键词搜索 API 根据用户输入的关键字进行 POI 搜索,并返回相关的信息""" try: response = requests.get( "https://restapi.amap.com/v3/place/text", params={ "key": AMAP_MAPS_API_KEY, "keywords": keywords, "city": city, "citylimit": citylimit } ) response.raise_for_status() data = response.json() if data["status"] != "1": return {"error": f"Text Search failed: {data.get('info') or data.get('infocode')}"} suggestion_cities = [] if data.get("suggestion", {}).get("cities"): for city in data["suggestion"]["cities"]: suggestion_cities.append({"name": city.get("name")}) pois = [] for poi in data.get("pois", []): pois.append({ "id": poi.get("id"), "name": poi.get("name"), "address": poi.get("address"), "typecode": poi.get("typecode") }) return { "suggestion": { "keywords": data.get("suggestion", {}).get("keywords"), "cities": suggestion_cities }, "pois": pois } except requests.exceptions.RequestException as e: return {"error": f"Request failed: {str(e)}"}

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/sugarforever/amap-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server