Skip to main content
Glama
cablate

MCP Google Map Server

search_nearby

Find nearby locations by specifying a center point, keyword, radius, and filters like open status or minimum rating. Ideal for identifying places such as restaurants or cafés in your vicinity using Google Maps data.

Instructions

搜尋附近的地點

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
centerYes搜尋中心點
keywordNo搜尋關鍵字(例如:餐廳、咖啡廳)
minRatingNo最低評分要求(0-5)
openNowNo是否只顯示營業中的地點
radiusNo搜尋半徑(公尺)

Implementation Reference

  • Main handler function that executes the tool logic: creates PlacesSearcher instance and calls its searchNearby method, formats the response.
    async function ACTION(params: SearchNearbyParams): 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.searchNearby(params);
    
        if (!result.success) {
          return {
            content: [{ type: "text", text: result.error || "Search failed" }],
            isError: true,
          };
        }
    
        return {
          content: [
            {
              type: "text",
              text: `location: ${JSON.stringify(result.location, null, 2)}\n` + 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 searching nearby places: ${errorMessage}` }],
        };
      }
    }
  • Zod schema defining input parameters for the search_nearby tool.
    const SCHEMA = {
      center: z.object({
        value: z.string().describe("Address, landmark name, or coordinates (coordinate format: lat,lng)"),
        isCoordinates: z.boolean().default(false).describe("Whether the value is coordinates"),
      }).describe("Search center point (e.g. value: 49.3268778,-123.0585982, isCoordinates: true)"),
      keyword: z.string().optional().describe("Search keyword (e.g., restaurant, cafe, hotel)"),
      radius: z.number().default(1000).describe("Search radius in meters"),
      openNow: z.boolean().default(false).describe("Only show places that are currently open"),
      minRating: z.number().min(0).max(5).optional().describe("Minimum rating requirement (0-5)"),
    };
  • src/config.ts:24-28 (registration)
    Registration of the search_nearby tool in the server configuration array.
      name: SearchNearby.NAME,
      description: SearchNearby.DESCRIPTION,
      schema: SearchNearby.SCHEMA,
      action: (params: SearchNearbyParams) => SearchNearby.ACTION(params),
    },
  • Helper method in PlacesSearcher class that performs the actual nearby search using Google Maps tools and processes results.
    async searchNearby(params: { center: { value: string; isCoordinates: boolean }; keyword?: string; radius?: number; openNow?: boolean; minRating?: number }): Promise<SearchNearbyResponse> {
      try {
        const location = await this.mapsTools.getLocation(params.center);
        const places = await this.mapsTools.searchNearbyPlaces({
          location,
          keyword: params.keyword,
          radius: params.radius,
          openNow: params.openNow,
          minRating: params.minRating,
        });
    
        return {
          location: location,
          success: true,
          data: places.map((place) => ({
            name: place.name,
            place_id: place.place_id,
            address: place.formatted_address,
            location: place.geometry.location,
            rating: place.rating,
            total_ratings: place.user_ratings_total,
            open_now: place.opening_hours?.open_now,
          })),
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : "An error occurred during search",
        };
      }
    }
  • Low-level helper in GoogleMapsTools that calls Google Places API placesNearby and applies minRating filter.
    async searchNearbyPlaces(params: SearchParams): Promise<PlaceResult[]> {
      const searchParams = {
        location: params.location,
        radius: params.radius || 1000,
        keyword: params.keyword,
        opennow: params.openNow,
        language: this.defaultLanguage,
        key: this.apiKey,
      };
    
      try {
        const response = await this.client.placesNearby({
          params: searchParams,
        });
    
        let results = response.data.results;
    
        if (params.minRating) {
          results = results.filter((place) => (place.rating || 0) >= (params.minRating || 0));
        }
    
        return results as PlaceResult[];
      } catch (error: any) {
        Logger.error("Error in searchNearbyPlaces:", error);
        throw new Error(`Failed to search nearby places: ${extractErrorMessage(error)}`);
      }
    }
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 only states the action ('搜尋附近的地點') without mentioning permissions, rate limits, pagination, or what the search returns (e.g., list of places with details). For a search tool with 5 parameters and no output schema, this is a significant gap in transparency.

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

Conciseness4/5

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

The description is a single, efficient sentence ('搜尋附近的地點') that is front-loaded and wastes no words. However, it's overly concise to the point of under-specification, missing context that would help the agent. It earns a 4 for brevity but loses points for not being sufficiently informative.

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 complexity (5 parameters, nested objects, no output schema, and no annotations), the description is incomplete. It doesn't explain what the tool returns, how results are filtered or sorted, or error conditions. For a search tool with rich input options, 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?

Schema description coverage is 100%, so the schema already documents all 5 parameters thoroughly. The description adds no additional meaning beyond what's in the schema (e.g., it doesn't explain how 'center' interacts with 'radius' or typical use cases for 'keyword'). Baseline 3 is appropriate when the schema does the heavy lifting.

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

Purpose3/5

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

The description '搜尋附近的地點' (Search for nearby places) states the general purpose but lacks specificity. It mentions the verb '搜尋' (search) and resource '地點' (places), but doesn't distinguish from siblings like 'maps_geocode' or 'get_place_details' which also involve location-related operations. The purpose is clear but not differentiated.

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention context, prerequisites, or exclusions. Given siblings like 'maps_geocode' (for address conversion) and 'get_place_details' (for specific place info), the lack of usage guidelines leaves the agent uncertain about selection.

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

Related 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/cablate/mcp-google-map'

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