get_prices
Retrieve product price observations and statistics by barcode, with optional country filtering. Provides individual price data and aggregated metrics like minimum, average, and count per country.
Instructions
Get price observations and stats for a product. Optionally filter by country. Returns individual observations and min/avg/count stats per country.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| barcode | Yes | Product barcode (8-14 digits) | |
| country | No | 2-letter country code (e.g. "DE", "TR", "US") |
Implementation Reference
- src/index.ts:71-88 (handler)Tool registration and handler implementation for "get_prices" in src/index.ts. It performs a GET request to the price atlas API.
server.tool( 'get_prices', 'Get price observations and stats for a product. Optionally filter by country. Returns individual observations and min/avg/count stats per country.', { barcode: z.string().describe('Product barcode (8-14 digits)'), country: z.string().length(2).optional().describe('2-letter country code (e.g. "DE", "TR", "US")'), }, async ({ barcode, country }) => { try { let path = `/api/prices?barcode=${barcode}`; if (country) path += `&country=${country}`; const prices = await api(path); return text(prices); } catch (e) { return errorResult(`Get prices failed: ${(e as Error).message}`); } }, );