search-places
Find detailed business information by searching for places using queries, location, country, language, and pagination. Integrates with Dumpling AI for comprehensive data access.
Instructions
Search for places with detailed business information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| country | No | Country code (e.g., 'us') | |
| language | No | Language code (e.g., 'en') | |
| location | No | Location name | |
| page | No | Page number | |
| query | Yes | Search query |
Implementation Reference
- src/index.ts:217-232 (handler)Handler function that proxies the request to the external Dumpling AI API endpoint for searching places, authenticates with API key, and returns the JSON response as text content.async ({ query, country, location, 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-places`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ query, country, location, 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:210-216 (schema)Zod schema defining the input parameters for the search-places tool: query (required), and optional country, location, language, page.{ query: z.string().describe("Search query"), country: z.string().optional().describe("Country code (e.g., 'us')"), location: z.string().optional().describe("Location name"), language: z.string().optional().describe("Language code (e.g., 'en')"), page: z.number().optional().describe("Page number"), },
- src/index.ts:207-233 (registration)Full registration of the 'search-places' MCP tool using server.tool, including name, description, input schema, and handler function.server.tool( "search-places", "Search for places with detailed business information.", { query: z.string().describe("Search query"), country: z.string().optional().describe("Country code (e.g., 'us')"), location: z.string().optional().describe("Location name"), language: z.string().optional().describe("Language code (e.g., 'en')"), page: z.number().optional().describe("Page number"), }, async ({ query, country, location, 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-places`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ query, country, location, 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) }] }; } );