search-maps
Find locations and businesses on Google Maps using search queries, GPS coordinates, or place identifiers within the Dumpling AI MCP Server.
Instructions
Search Google Maps for locations and businesses.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query | |
| gpsPositionZoom | No | GPS coordinates with zoom (e.g., 'lat,long,zoom') | |
| placeId | No | Google Place ID | |
| cid | No | Google Maps CID | |
| language | No | Language code (e.g., 'en') | |
| page | No | Page number |
Implementation Reference
- src/index.ts:181-203 (handler)The handler function that executes the tool logic by making an API call to Dumpling AI's search-maps endpoint with the provided parameters.async ({ query, gpsPositionZoom, placeId, cid, language, page }) => { const apiKey = process.env.DUMPLING_API_KEY; if (!apiKey) throw new Error("DUMPLING_API_KEY not set"); const response = await fetch(`${NWS_API_BASE}/api/v1/search-maps`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ query, gpsPositionZoom, placeId, cid, language, page, }), }); if (!response.ok) throw new Error(`Failed: ${response.status} ${await response.text()}`); const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; }
- src/index.ts:170-180 (schema)Zod schema defining the input parameters for the search-maps tool, including query, optional GPS position, place ID, CID, language, and page.{ query: z.string().describe("Search query"), gpsPositionZoom: z .string() .optional() .describe("GPS coordinates with zoom (e.g., 'lat,long,zoom')"), placeId: z.string().optional().describe("Google Place ID"), cid: z.string().optional().describe("Google Maps CID"), language: z.string().optional().describe("Language code (e.g., 'en')"), page: z.number().optional().describe("Page number"), },
- src/index.ts:167-204 (registration)Registers the 'search-maps' tool with the MCP server using server.tool(), providing name, description, input schema, and handler function.server.tool( "search-maps", "Search Google Maps for locations and businesses.", { query: z.string().describe("Search query"), gpsPositionZoom: z .string() .optional() .describe("GPS coordinates with zoom (e.g., 'lat,long,zoom')"), placeId: z.string().optional().describe("Google Place ID"), cid: z.string().optional().describe("Google Maps CID"), language: z.string().optional().describe("Language code (e.g., 'en')"), page: z.number().optional().describe("Page number"), }, async ({ query, gpsPositionZoom, placeId, cid, language, page }) => { const apiKey = process.env.DUMPLING_API_KEY; if (!apiKey) throw new Error("DUMPLING_API_KEY not set"); const response = await fetch(`${NWS_API_BASE}/api/v1/search-maps`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ query, gpsPositionZoom, placeId, cid, language, page, }), }); if (!response.ok) throw new Error(`Failed: ${response.status} ${await response.text()}`); const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } );