Skip to main content
Glama

Get Place Details

get_place_details

Retrieve comprehensive information about a specific location using its Google Maps Place ID to access details like address, contact, and business data.

Instructions

Get detailed information about a specific place

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
placeIdYesGoogle Maps Place ID

Implementation Reference

  • Core handler function that fetches and processes place details from Google Places API using the google-maps-services-js client.
    async getPlaceDetails(
        placeId: string
    ): Promise<ServiceResponse<PlaceDetails>> {
        try {
            validateRequiredString(placeId, "Place ID");
    
            const response = await this.client.placeDetails({
                params: {
                    key: config.googleMapsApiKey,
                    place_id: placeId,
                    language: config.defaultLanguage as Language,
                    fields: [
                        "name",
                        "formatted_address",
                        "geometry",
                        "googleMapsLinks",
                        "rating",
                        "reviews",
                        "reviewSummary",
                        "user_ratings_total",
                        "opening_hours",
                        "photos",
                        "price_level",
                        "types",
                        "website",
                        "formatted_phone_number",
                    ],
                },
            });
    
            const place = response.data.result;
    
            // First check if the API call was successful
            if (response.data.status !== "OK") {
                throw new Error(
                    `Google Places API error: ${response.data.status} - ${response.data.error_message || "Unknown error"}`
                );
            }
    
            // Check if we have a result
            if (!place) {
                throw new Error(
                    "No place data returned from Google Places API"
                );
            }
    
            // Check for required fields with detailed error message
            if (!place.place_id || !place.name) {
                throw new Error(
                    `Missing required place data - place_id: ${place.place_id || "undefined"}, name: ${place.name || "undefined"}, API status: ${response.data.status}`
                );
            }
            return {
                success: true,
                data: {
                    placeId: place.place_id,
                    name: place.name,
                    formattedAddress: place.formatted_address,
                    location: place.geometry?.location,
                    rating: place.rating,
                    userRatingsTotal: place.user_ratings_total,
                    openingHours: place.opening_hours
                        ? {
                              openNow: place.opening_hours.open_now,
                              periods: place.opening_hours.periods?.map(
                                  (period) => ({
                                      open: {
                                          day: period.open.day,
                                          time: period.open.time || "",
                                      },
                                      close: period.close
                                          ? {
                                                day: period.close.day,
                                                time: period.close.time || "",
                                            }
                                          : { day: 0, time: "" },
                                  })
                              ),
                          }
                        : undefined,
                    photos: place.photos?.map((photo) => ({
                        photoReference: photo.photo_reference,
                        height: photo.height,
                        width: photo.width,
                    })),
                    priceLevel: place.price_level,
                    types: place.types,
                    website: place.website,
                    phoneNumber: place.formatted_phone_number,
                },
            };
        } catch (error) {
            return handleError(error);
        }
    }
  • Registers the get_place_details tool with the MCP server, providing schema, title, description, and a thin wrapper handler that delegates to the PlacesSearcher service.
    server.registerTool(
        "get_place_details",
        {
            title: "Get Place Details",
            description: "Get detailed information about a specific place",
            inputSchema: PlaceDetailsSchema,
        },
        async (args) => {
            try {
                const result = await placesSearcher.getPlaceDetails(
                    args.placeId
                );
                return {
                    content: [
                        { type: "text", text: JSON.stringify(result, null, 2) },
                    ],
                    isError: !result.success,
                };
            } catch (error) {
                const errorResponse = handleError(error);
                return {
                    content: [
                        {
                            type: "text",
                            text:
                                errorResponse.error ||
                                "An unknown error occurred",
                        },
                    ],
                    isError: true,
                };
            }
        }
    );
  • Zod schema defining the input for the tool: a required placeId string.
    export const PlaceDetailsSchema = {
      placeId: z.string().describe("Google Maps Place ID")
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states it 'gets' information, implying a read-only operation, but doesn't clarify aspects like rate limits, authentication needs, error handling, or what 'detailed information' entails (e.g., fields returned). This leaves significant gaps for a tool with no structured safety hints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. Every part ('Get detailed information about a specific place') contributes directly to understanding the tool's function, making it appropriately sized and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter, no nested objects) and high schema coverage, the description is minimally adequate. However, with no annotations and no output schema, it fails to explain behavioral traits or return values, leaving gaps in completeness. It meets the baseline for a simple tool but doesn't fully compensate for the lack of structured data.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the single parameter 'placeId' documented as a 'Google Maps Place ID'. The description adds no additional meaning beyond this, such as format examples or where to obtain the ID. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, but there's no extra value from the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get detailed information') and resource ('about a specific place'), making the purpose understandable. It distinguishes from siblings like get_directions or search_nearby by focusing on details for a single place rather than routing or searching. However, it doesn't specify what 'detailed information' includes, which slightly reduces specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a placeId), exclusions, or comparisons to siblings like get_geocode (for address lookup) or search_nearby (for finding places). Usage is implied by the name but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/BACH-AI-Tools/MCP-Google-Maps'

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