Skip to main content
Glama
ricleedo

Google Services MCP Server

by ricleedo

place-details

Retrieve comprehensive information about a specific location using its Google Place ID, including address, contact details, and operational data.

Instructions

Get detailed information about a specific place

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
place_idYesThe Google Place ID

Implementation Reference

  • The main handler function for the 'place-details' tool. It fetches detailed information about a place using the Google Maps Place Details API, formats the response using formatPlaceDetailsToMarkdown, and returns it as MCP content.
    export async function placeDetails(
      params: z.infer<typeof placeDetailsSchema>,
      extra?: any
    ) {
      const apiKey = process.env.GOOGLE_MAPS_API_KEY;
      if (!apiKey) {
        throw new Error("GOOGLE_MAPS_API_KEY is required");
      }
    
      try {
        const response = await googleMapsClient.placeDetails({
          params: {
            place_id: params.place_id,
            key: apiKey,
          },
        });
    
        const place = response.data.result;
    
        const placeData = {
          name: place.name,
          formatted_address: place.formatted_address,
          phone_number: place.formatted_phone_number,
          website: place.website,
          rating: place.rating,
          user_ratings_total: place.user_ratings_total,
          price_level: place.price_level,
          opening_hours: place.opening_hours?.weekday_text,
          types: place.types,
          latitude: place.geometry?.location.lat,
          longitude: place.geometry?.location.lng,
        };
    
        return {
          content: [
            {
              type: "text" as const,
              text: formatPlaceDetailsToMarkdown(placeData),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text" as const,
              text: `Error getting place details: ${
                error instanceof Error ? error.message : String(error)
              }`,
            },
          ],
        };
      }
    }
  • Zod schema defining the input for the 'place-details' tool, requiring a 'place_id' string.
    export const placeDetailsSchema = z.object({
      place_id: z.string().describe("The Google Place ID"),
    });
  • src/index.ts:110-117 (registration)
    Registration of the 'place-details' tool on the MCP server, linking the name, description, schema, and handler function.
    server.tool(
      "place-details",
      "Get detailed information about a specific place",
      placeDetailsSchema.shape,
      async (params) => {
        return await placeDetails(params);
      }
    );
  • Helper function to format place details into Markdown for the tool response.
    function formatPlaceDetailsToMarkdown(place: any): string {
      let markdown = `# ${place.name}\n\n`;
      
      if (place.formatted_address) markdown += `Address: ${place.formatted_address}  \n`;
      if (place.phone_number) markdown += `Phone: ${place.phone_number}  \n`;
      if (place.website) markdown += `Website: [Visit](${place.website})  \n`;
      
      if (place.rating) {
        markdown += `Rating: ${place.rating}⭐`;
        if (place.user_ratings_total) markdown += ` (${place.user_ratings_total} reviews)`;
        markdown += `  \n`;
      }
      
      if (place.price_level !== undefined) {
        const priceSymbols = '$'.repeat(place.price_level + 1);
        markdown += `Price Level: ${priceSymbols}  \n`;
      }
      
      if (place.latitude && place.longitude) {
        markdown += `Location: ${place.latitude}, ${place.longitude}  \n`;
        markdown += `Maps: [View](https://maps.google.com/?q=${place.latitude},${place.longitude})  \n`;
      }
      
      if (place.opening_hours && place.opening_hours.length) {
        markdown += `\n## Hours\n`;
        place.opening_hours.forEach((hours: string) => {
          markdown += `- ${hours}\n`;
        });
      }
      
      if (place.types && place.types.length) {
        markdown += `\nCategories: ${place.types.join(', ')}`;
      }
      
      return markdown;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states 'Get detailed information', implying a read-only operation, but doesn't disclose behavioral traits like authentication needs, rate limits, error handling, or what 'detailed information' entails (e.g., format, fields). This leaves significant gaps for a tool with no annotation coverage.

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 with zero waste—'Get detailed information about a specific place'. It's front-loaded and appropriately sized for a simple tool, earning full marks for conciseness.

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

Completeness2/5

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

Given no annotations, no output schema, and a simple input schema, the description is incomplete. It doesn't explain what 'detailed information' includes (e.g., address, ratings, hours), return format, or error cases. For a tool with minimal structured data, more context is needed to guide effective use.

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?

The input schema has 100% description coverage, with 'place_id' documented as 'The Google Place ID'. The description adds no parameter-specific details beyond this, such as format examples or constraints. With high schema coverage, the baseline is 3, as the schema does the heavy lifting.

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 verb 'Get' and the resource 'detailed information about a specific place', making the purpose evident. However, it doesn't explicitly differentiate from sibling tools like 'places-search' or 'geocode', which also retrieve place-related data, so it misses full sibling distinction.

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 such as 'places-search' (for broader queries) or 'geocode' (for address-based lookups). It lacks explicit context, prerequisites, or exclusions, leaving usage unclear relative to siblings.

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/ricleedo/Google-Service-MCP'

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