get_product
Retrieve complete product details including price, brand, size, unit price, tags, category, image, and active promotions for a specific grocery chain and product ID. Use after searching products to drill into a result.
Instructions
Fetch full product details for a specific chain + product ID pair. Returns price, brand, size, unit price, tags, category, image URL, and active promotions. Obtain product IDs from search_products. Useful for drilling into a search result. Use for "get details for this Migros product" or "what is the unit price of this item?".
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | Yes | The grocery chain that owns this product ID. | |
| id | Yes | Chain-specific product identifier, e.g. Migros cumulus ID or Coop product number. Obtain via search_products. |
Implementation Reference
- src/tools/get_product.ts:15-38 (handler)The getProductHandler function that executes the tool logic. It looks up the chain-specific adapter from the registry, calls adapter.getProduct(input.id), and returns the normalized product or throws a ToolError on failure.
export async function getProductHandler( registry: AdapterRegistry, input: GetProductInput, ): Promise<NormalizedProduct | null> { const adapter = registry.get(input.chain); if (!adapter) { throw new ToolError( 'adapter_not_registered', `No adapter registered for chain "${input.chain}"`, 'Ensure the chain is enabled in the server configuration. For Denner, set the DENNER_JWT env var.', ); } const r = await adapter.getProduct(input.id); if (!r.ok) { throw new ToolError( r.error.code, `Product fetch failed for ${input.chain}/${input.id}: ${r.error.code}`, r.error.code === 'not_found' ? 'The product ID may be invalid or discontinued. Re-run search_products to get a fresh ID.' : 'Try again later or use search_products to find an alternative.', ); } return r.data; } - src/tools/get_product.ts:6-11 (schema)The getProductSchema Zod schema defining the input: 'chain' (enum of supported grocery chains) and 'id' (string, min 1). Describes the tool purpose.
export const getProductSchema = z.object({ chain: z.enum(['migros', 'coop', 'aldi', 'denner', 'lidl', 'farmy', 'volgshop', 'ottos']) .describe('The grocery chain that owns this product ID.'), id: z.string().min(1) .describe('Chain-specific product identifier, e.g. Migros cumulus ID or Coop product number. Obtain via search_products.'), }).describe('Fetch full product details (price, size, tags, promotions) for a specific chain + product ID pair. Use after search_products to drill into a result.'); - src/index.ts:72-81 (registration)Registration of the 'get_product' tool in the MCP server with name, description, schema, and handler. Imported at line 25 from './tools/get_product.js'.
{ name: 'get_product', description: [ 'Fetch full product details for a specific chain + product ID pair.', 'Returns price, brand, size, unit price, tags, category, image URL, and active promotions.', 'Obtain product IDs from search_products. Useful for drilling into a search result.', 'Use for "get details for this Migros product" or "what is the unit price of this item?".', ].join(' '), schema: getProductSchema, handler: getProductHandler, - src/adapters/types.ts:227-231 (helper)The getProduct method signature in the StoreAdapter interface that all chain adapters must implement. Returns Promise<AdapterResult<NormalizedProduct | null>>.
getProduct(id: string): Promise<AdapterResult<NormalizedProduct | null>>; searchStores(q: StoreQuery): Promise<AdapterResult<NormalizedStore[]>>; getPromotions(q: PromotionQuery): Promise<AdapterResult<NormalizedPromotion[]>>; findStoresWithStock?(productId: string, near?: GeoPoint): Promise<AdapterResult<StockResult[]>>; }