Skip to main content
Glama
bunkerapps

Superprecio MCP Server

by bunkerapps

find_nearby_supermarkets

Locate supermarkets near your GPS coordinates to plan shopping routes and compare prices across stores in Argentina. Search by latitude/longitude with customizable radius.

Instructions

Find supermarkets near your current location using GPS coordinates.

Discover which supermarkets are closest to you!

Features:

  • Search by latitude and longitude

  • Customizable search radius (default: 5km)

  • Get distance in km and meters

  • See full addresses and contact info

  • Opening hours when available

Perfect for:

  • Finding nearby stores after optimizing your shopping list

  • Planning your shopping route

  • Discovering new supermarkets in your area

  • Getting directions to the best-priced store

Example coordinates for Buenos Aires city center:

  • Latitude: -34.6037

  • Longitude: -58.3816

The tool uses the Haversine formula to calculate accurate distances.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latitudeYesLatitude coordinate (-90 to 90)
longitudeYesLongitude coordinate (-180 to 180)
radiusKmNoSearch radius in kilometers (default: 5km)

Implementation Reference

  • Main handler function for the 'find_nearby_supermarkets' tool. Calls the SuperPrecioApiClient, handles API response, errors, formats output with supermarket details, distances, and summaries.
    export async function executeFindNearbySupermarkets(
      client: SuperPrecioApiClient,
      args: { latitude: number; longitude: number; radiusKm?: number }
    ) {
      const response = await client.findNearbySupermarkets({
        lat: args.latitude,
        lng: args.longitude,
        radius: args.radiusKm || 5,
      });
    
      if (!response.success) {
        return {
          content: [
            {
              type: 'text',
              text: `Failed to find nearby supermarkets: ${response.message || 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    
      const locations = response.locations || [];
      const count = response.found || 0;
    
      if (count === 0) {
        return {
          content: [
            {
              type: 'text',
              text: `
    πŸ“ No supermarkets found within ${response.radiusKm}km of your location.
    
    Search location:
      Latitude: ${response.searchLocation.latitude}
      Longitude: ${response.searchLocation.longitude}
    
    Try:
    - Increasing the search radius
    - Checking if your coordinates are correct
    - Moving to a different location
    `,
            },
          ],
        };
      }
    
      const summary = `
    πŸ“ Nearby Supermarkets (${count} found)
    Search radius: ${response.radiusKm}km
    Location: ${response.searchLocation.latitude.toFixed(4)}, ${response.searchLocation.longitude.toFixed(4)}
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    
    ${locations
      .map((loc: any, i: number) => {
        return `
    ${i + 1}. ${loc.supermarketName} - ${loc.branchName}
       πŸ“ Distance: ${loc.distance}km (${loc.distanceMeters}m)
       πŸ“ Address: ${loc.address}, ${loc.city}
       ${loc.phone ? `πŸ“ž Phone: ${loc.phone}` : ''}
       ${loc.openingHours ? `πŸ•’ Hours: ${loc.openingHours}` : ''}
       πŸ—ΊοΈ  Coordinates: ${loc.coordinates.latitude}, ${loc.coordinates.longitude}
    `;
      })
      .join('\n')}
    
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    πŸš— Closest supermarket: ${locations[0].supermarketName} (${locations[0].distance}km away)
    
    πŸ’‘ Tip: After optimizing your shopping list, use this to find the nearest
       location of the best-priced supermarket!
    `;
    
      return {
        content: [
          {
            type: 'text',
            text: summary,
          },
          {
            type: 'text',
            text: JSON.stringify(response, null, 2),
          },
        ],
      };
    }
  • Tool schema definition including name, description, and input schema for latitude, longitude, and optional radius.
    export const findNearbySupermarketsTool = {
      name: 'find_nearby_supermarkets',
      description: `Find supermarkets near your current location using GPS coordinates.
    
    Discover which supermarkets are closest to you!
    
    Features:
    - Search by latitude and longitude
    - Customizable search radius (default: 5km)
    - Get distance in km and meters
    - See full addresses and contact info
    - Opening hours when available
    
    Perfect for:
    - Finding nearby stores after optimizing your shopping list
    - Planning your shopping route
    - Discovering new supermarkets in your area
    - Getting directions to the best-priced store
    
    Example coordinates for Buenos Aires city center:
    - Latitude: -34.6037
    - Longitude: -58.3816
    
    The tool uses the Haversine formula to calculate accurate distances.`,
      inputSchema: {
        type: 'object',
        properties: {
          latitude: {
            type: 'number',
            description: 'Latitude coordinate (-90 to 90)',
            minimum: -90,
            maximum: 90,
          },
          longitude: {
            type: 'number',
            description: 'Longitude coordinate (-180 to 180)',
            minimum: -180,
            maximum: 180,
          },
          radiusKm: {
            type: 'number',
            description: 'Search radius in kilometers (default: 5km)',
            minimum: 0.1,
            maximum: 50,
            default: 5,
          },
        },
        required: ['latitude', 'longitude'],
      },
    };
  • src/index.ts:89-116 (registration)
    Registers the tool in the MCP server's listTools handler by including findNearbySupermarketsTool in the tools array.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          // V1 Tools
          searchProductsTool,
          searchByCodeTool,
          comparePriceTool,
          getBestDealsTool,
          sendNotificationTool,
          subscribeDeviceTool,
    
          // V2 Tools - Shopping Lists
          createShoppingListTool,
          addItemsToListTool,
          getShoppingListsTool,
          optimizeShoppingListTool,
          removeShoppingListTool,
    
          // V2 Tools - Price Alerts
          setPriceAlertTool,
          getMyAlertsTool,
          removePriceAlertTool,
    
          // V2 Tools - Location
          findNearbySupermarketsTool,
        ],
      };
    });
  • src/index.ts:170-172 (registration)
    Dispatches execution of the tool in the MCP server's CallToolRequestSchema handler via switch case.
    case 'find_nearby_supermarkets':
      return await executeFindNearbySupermarkets(apiClient, args as any);
  • API client method that performs the HTTP GET request to '/api/locations/nearby' to fetch nearby supermarkets data.
    async findNearbySupermarkets(params: {
      lat: number;
      lng: number;
      radius?: number;
    }): Promise<any> {
      try {
        const response = await this.client.get('/api/locations/nearby', { params });
        return response.data;
      } catch (error) {
        throw this.handleError(error);
      }
    }
Behavior4/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 and does this well. It reveals key behavioral traits: the tool calculates distances using the Haversine formula, provides distance in km/meters, returns addresses and contact info, includes opening hours when available, and has a default search radius of 5km. It doesn't mention rate limits, authentication needs, or data freshness concerns.

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

Conciseness3/5

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

The description is appropriately front-loaded with the core purpose, but contains some redundancy and marketing language that doesn't earn its place. Sentences like 'Discover which supermarkets are closest to you!' and the 'Perfect for' bullet points add little operational value. The Haversine formula explanation is useful but could be more concise. Overall structure is logical but could be tighter.

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

Completeness4/5

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

Given the tool's moderate complexity, no annotations, and no output schema, the description provides good contextual completeness. It explains what the tool does, how it works (Haversine formula), what information it returns (addresses, contact info, opening hours, distances), and includes practical examples. The main gap is the lack of output format specification, which would be helpful given no output schema exists.

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 fully documents all three parameters (latitude, longitude, radiusKm). The description adds minimal value beyond the schema - it mentions 'Search by latitude and longitude' and 'Customizable search radius (default: 5km)' but provides no additional semantic context about parameter usage or implications. The example coordinates are helpful but don't fundamentally enhance parameter understanding.

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

Purpose5/5

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

The description clearly states the tool's purpose with specific verbs ('Find supermarkets near your current location') and resource ('supermarkets'), distinguishing it from sibling tools like 'search_products' or 'get_best_deals' which focus on products/deals rather than physical store locations. It explicitly mentions using GPS coordinates for location-based searching.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool ('Finding nearby stores after optimizing your shopping list', 'Planning your shopping route', 'Discovering new supermarkets in your area'), but doesn't explicitly state when NOT to use it or mention alternatives among the sibling tools. The 'Perfect for' section gives good usage scenarios without exclusions.

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/bunkerapps/superprecio_mcp'

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