Skip to main content
Glama
nicktcode

Swissgroceries MCP

find_stores

Find grocery stores near any Swiss location by ZIP code, coordinates, or address. Filter by chain and radius to get store names, addresses, and hours.

Instructions

Find grocery stores near a location, filtered by chain and search radius. Accepts a Swiss ZIP code, GPS coordinates, or a free-text address as the search center. Returns store name, address, chain, location, and opening hours where available. Use for "find a Migros near me", "which Coop branches are in 8001?", or before checking stock.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nearYesCenter of the search radius. Pass either coordinates, a Swiss ZIP, or a free-text address.
chainsNoLimit results to specific chains. Omit to search all configured chains.
radiusKmNoSearch radius in kilometers (1–50). Defaults to 5 km.

Implementation Reference

  • The main handler function for the 'find_stores' tool. It geocodes the input location (lat/lng, zip, or free-text address), then queries all adapters with 'storeSearch' capability in parallel, returning flattened store results.
    export async function findStoresHandler(
      registry: AdapterRegistry,
      input: FindStoresInput,
    ): Promise<NormalizedStore[]> {
      const geo = await geocode(input.near as any);
      if (!geo.ok) {
        const err = geo.error;
        if (err.code === 'unknown_zip') {
          throw new ToolError(
            'unknown_zip',
            `ZIP "${(err as any).zip}" is not in the lookup table`,
            'Pass { lat, lng } directly or check that the ZIP is a valid Swiss PLZ (e.g. "8001").',
          );
        }
        if (err.code === 'address_not_found') {
          throw new ToolError(
            'address_not_found',
            `Address "${(err as any).query}" could not be geocoded`,
            'Try a more specific address or pass a Swiss ZIP code or { lat, lng } coordinates.',
          );
        }
        if (err.code === 'unavailable') {
          throw new ToolError(
            'unavailable',
            (err as any).reason,
            'The Nominatim geocoding service is temporarily unavailable. Try passing a ZIP or { lat, lng } instead.',
          );
        }
        throw new ToolError(
          err.code,
          'address_unsupported' in err ? (err as any).reason : err.code,
          'Pass a Swiss ZIP code or { lat, lng } coordinates instead of a free-text address.',
        );
      }
    
      const radius = input.radiusKm ?? 5;
      const adapters = registry.withCapability('storeSearch', input.chains);
    
      const results = await Promise.all(
        adapters.map(async (a) => {
          const r = await a.searchStores({
            near: { lat: geo.data.lat, lng: geo.data.lng },
            radiusKm: radius,
            cityHint: geo.data.city,
          });
          return r.ok ? r.data : [];
        }),
      );
      return results.flat();
    }
  • Zod schema defining the input for 'find_stores': 'near' (lat/lng, zip, or address), optional 'chains' filter, and optional 'radiusKm' (max 50, default 5).
    export const findStoresSchema = z.object({
      near: z.union([
        z.object({
          lat: z.number().describe('Latitude in decimal degrees (WGS 84), e.g. 47.3769'),
          lng: z.number().describe('Longitude in decimal degrees (WGS 84), e.g. 8.5417'),
        }).describe('Coordinates of the search center'),
        z.object({
          zip: z.string().describe('Swiss postal code (PLZ / NPA), e.g. "8001"'),
        }).describe('Swiss postal code (PLZ), e.g. "8001"'),
        z.object({
          address: z.string().describe('Free-text address string, e.g. "Bahnhofstrasse 1, Zürich" — geocoded via OpenStreetMap Nominatim'),
        }).describe('Free-text address — geocoded via Nominatim; prefer zip or lat/lng for speed'),
      ]).describe('Center of the search radius. Pass either coordinates, a Swiss ZIP, or a free-text address.'),
      chains: z.array(z.enum(['migros', 'coop', 'aldi', 'denner', 'lidl', 'farmy', 'volgshop', 'ottos']))
        .optional()
        .describe('Limit results to specific chains. Omit to search all configured chains.'),
      radiusKm: z.number().positive().max(50)
        .optional()
        .describe('Search radius in kilometers (1–50). Defaults to 5 km.'),
    }).describe('Find grocery stores near a location, filtered by chain and radius. Returns store name, address, location, and hours.');
  • src/index.ts:49-60 (registration)
    Registration of the 'find_stores' tool in the TOOLS array, mapping the name to its schema and handler for MCP server dispatch.
    const TOOLS = [
      {
        name: 'find_stores',
        description: [
          'Find grocery stores near a location, filtered by chain and search radius.',
          'Accepts a Swiss ZIP code, GPS coordinates, or a free-text address as the search center.',
          'Returns store name, address, chain, location, and opening hours where available.',
          'Use for "find a Migros near me", "which Coop branches are in 8001?", or before checking stock.',
        ].join(' '),
        schema: findStoresSchema,
        handler: findStoresHandler,
      },
  • The 'geocode' helper service imported from '../services/geocoding.js' which is used to resolve addresses/ZIP codes into lat/lng coordinates.
    import { geocode } from '../services/geocoding.js';
    import { ToolError } from './errors.js';
Behavior3/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. It explains that the tool returns store details including opening hours where available, indicating a read-only operation. However, it does not disclose potential rate limits, authentication needs, or any side effects, which is acceptable for a simple search tool.

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 three sentences: first states purpose, second describes inputs, third summarizes outputs and examples. It is front-loaded with key information, no redundant phrases, and every sentence adds value.

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?

For a search tool with 3 parameters and no output schema, the description adequately covers inputs, outputs, and example usage. It mentions return fields (name, address, chain, location, hours). It could have explicitly stated the default radius, but that is detailed in the schema. Overall, it is sufficiently complete for an agent to use effectively.

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% coverage with descriptions for each parameter. The description adds minor context (e.g., prefer zip or lat/lng for speed, geocoding via Nominatim) but mostly restates schema information. The baseline score of 3 is appropriate as the description provides some additional guidance.

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 finds grocery stores near a location with filters for chain and radius, using specific verbs and resource. It also provides example use cases that distinguish it from siblings like find_stock and get_product.

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 gives concrete examples of when to use this tool ('find a Migros near me', 'which Coop branches are in 8001?') and hints at its role before checking stock. However, it does not explicitly state when not to use it or provide alternatives for non-store queries.

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/nicktcode/swissgroceries-mcp'

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