search-places
Find detailed business information by searching for places using location, country, and language parameters.
Instructions
Search for places with detailed business information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query | |
| country | No | Country code (e.g., 'us') | |
| location | No | Location name | |
| language | No | Language code (e.g., 'en') | |
| page | No | Page number |
Implementation Reference
- src/index.ts:217-232 (handler)The handler function for the 'search-places' tool. It proxies the request to the Dumpling AI API endpoint /api/v1/search-places, authenticates with DUMPLING_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 input schema for the 'search-places' tool defining parameters: query (required string), and optional country, location, language (strings), page (number).{ 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)The complete registration of the 'search-places' tool using McpServer.tool method, 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) }] }; } );