Skip to main content
Glama
ricleedo

Google Services MCP Server

by ricleedo

places-search

Search for places using text queries with location and radius parameters to find relevant results from Google Maps data.

Instructions

Search for places using text query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe search query
locationNoBias results around this location (e.g., 'lat,lng')
radiusNoSearch radius in meters

Implementation Reference

  • The main handler function for the 'places-search' tool. It uses Google Maps Text Search API to find places matching the query, optionally biased by location and radius. Formats up to 5 results using formatPlacesToMarkdown and returns as MCP content.
    export async function placesSearch(
      params: z.infer<typeof placesSearchSchema>,
      extra?: any
    ) {
      const apiKey = process.env.GOOGLE_MAPS_API_KEY;
      if (!apiKey) {
        throw new Error("GOOGLE_MAPS_API_KEY is required");
      }
    
      try {
        const requestParams: any = {
          query: params.query,
          key: apiKey,
        };
    
        if (params.location) {
          requestParams.location = params.location;
        }
        if (params.radius) {
          requestParams.radius = params.radius;
        }
    
        const response = await googleMapsClient.textSearch({
          params: requestParams,
        });
    
        const results = response.data.results;
        if (results.length === 0) {
          return {
            content: [
              {
                type: "text" as const,
                text: "No places found for the given query.",
              },
            ],
          };
        }
    
        const places = results.slice(0, 5).map((place) => ({
          name: place.name,
          formatted_address: place.formatted_address,
          latitude: place.geometry?.location.lat,
          longitude: place.geometry?.location.lng,
          place_id: place.place_id,
          rating: place.rating,
          types: place.types,
        }));
    
        return {
          content: [
            {
              type: "text" as const,
              text: formatPlacesToMarkdown(places),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text" as const,
              text: `Error searching places: ${
                error instanceof Error ? error.message : String(error)
              }`,
            },
          ],
        };
      }
    }
  • Zod schema for input validation of the places-search tool: required 'query' string, optional 'location' string (lat,lng), and 'radius' number.
    export const placesSearchSchema = z.object({
      query: z.string().describe("The search query"),
      location: z
        .string()
        .optional()
        .describe("Bias results around this location (e.g., 'lat,lng')"),
      radius: z.number().optional().describe("Search radius in meters"),
    });
  • src/index.ts:80-87 (registration)
    Tool registration in the MCP server, using the placesSearch handler and placesSearchSchema from maps.ts.
    server.tool(
      "places-search",
      "Search for places using text query",
      placesSearchSchema.shape,
      async (params) => {
        return await placesSearch(params);
      }
    );
  • Helper function used by placesSearch to format search results into a Markdown list with details like name, address, rating, location, and place ID.
    function formatPlacesToMarkdown(places: any[]): string {
      if (!places.length) return "No places found.";
      
      let markdown = `# Places Search Results (${places.length})\n\n`;
      
      places.forEach((place, index) => {
        markdown += `## ${index + 1}. ${place.name}\n`;
        markdown += `Address: ${place.formatted_address}  \n`;
        if (place.rating) {
          markdown += `Rating: ${place.rating}⭐  \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.place_id) {
          markdown += `Place ID: \`${place.place_id}\`  \n`;
        }
        markdown += `\n`;
      });
      
      return markdown;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Search') but doesn't mention whether this is a read-only operation, potential rate limits, authentication needs, or what the output format looks like (e.g., list of places with basic info). For a search tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 directly states the tool's purpose without any fluff. It is appropriately sized and front-loaded, making it easy to parse quickly. Every word earns its place by conveying essential information.

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 the tool's complexity (a search function with three parameters), lack of annotations, and no output schema, the description is insufficient. It doesn't explain what the search returns (e.g., types of places, fields included), error conditions, or usage constraints. For a tool with these contextual gaps, the description should provide more completeness 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 schema description coverage is 100%, with clear descriptions for all three parameters (query, location, radius). The description adds no additional semantic context beyond what the schema provides, such as examples of effective queries or how location biasing works in practice. This meets the baseline score when schema coverage is high.

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 ('Search') and resource ('places') with the method ('using text query'), making the purpose immediately understandable. It distinguishes from siblings like 'place-details' (which retrieves details for a specific place) and 'geocode' (which converts addresses to coordinates), though it doesn't explicitly mention these alternatives in the description itself.

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 like 'place-details' for detailed information about a specific place, 'geocode' for address-to-coordinate conversion, or 'airports-search' for specialized place searches. It also lacks context about prerequisites, such as when location or radius parameters are beneficial.

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