get_place_details
Retrieve comprehensive details of a specific location using its Google Maps place ID through the MCP Google Map Server. Ideal for developers needing precise location data.
Instructions
獲取特定地點的詳細資訊
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| placeId | Yes | Google Maps 地點 ID |
Implementation Reference
- src/tools/maps/placeDetails.ts:14-44 (handler)The ACTION function implementing the core logic of the get_place_details tool. It uses PlacesSearcher to fetch details and returns formatted content or error.async function ACTION(params: any): Promise<{ content: any[]; isError?: boolean }> { try { // Create a new PlacesSearcher instance with the current request's API key const apiKey = getCurrentApiKey(); const placesSearcher = new PlacesSearcher(apiKey); const result = await placesSearcher.getPlaceDetails(params.placeId); if (!result.success) { return { content: [{ type: "text", text: result.error || "Failed to get place details" }], isError: true, }; } return { content: [ { type: "text", text: JSON.stringify(result.data, null, 2), }, ], isError: false, }; } catch (error: any) { const errorMessage = error instanceof Error ? error.message : JSON.stringify(error); return { isError: true, content: [{ type: "text", text: `Error getting place details: ${errorMessage}` }], }; } }
- src/tools/maps/placeDetails.ts:8-10 (schema)Zod schema defining the input parameters for the tool: placeId (string).const SCHEMA = { placeId: z.string().describe("Google Maps place ID"), };
- src/config.ts:29-33 (registration)Tool registration in server configuration, specifying name, description, schema, and action handler.{ name: PlaceDetails.NAME, description: PlaceDetails.DESCRIPTION, schema: PlaceDetails.SCHEMA, action: (params: PlaceDetailsParams) => PlaceDetails.ACTION(params),