get-benefits
Find available discounts and benefits for financial product users by category, including Food, Entertainment, Services, and Fuel.
Instructions
Get available benefits and discounts for financial product users. | Obtener beneficios y descuentos disponibles para usuarios de productos financieros.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Benefit category (Food, Entertainment, Services, Fuel) | Categoría de beneficio (Alimentación, Entretenimiento, Servicios, Combustible) |
Implementation Reference
- src/tools/insurance.ts:89-109 (handler)Handler for the 'get-benefits' tool. Fetches all benefits using getBenefits(), optionally filters by 'category' parameter, and returns a JSON string with filtered benefits, count, and available categories.async ({ category }) => { const benefits = await getBenefits(); let filteredBenefits = [...benefits]; if (category) { filteredBenefits = filteredBenefits.filter(b => b.category.toLowerCase().includes(category.toLowerCase()) ); } return { content: [{ type: 'text' as const, text: JSON.stringify({ benefits: filteredBenefits, count: filteredBenefits.length, categories: [...new Set(benefits.map(b => b.category))] }, null, 2) }] }; }
- src/tools/insurance.ts:86-88 (schema)Input schema for the 'get-benefits' tool, defining an optional 'category' string parameter.{ category: z.string().optional().describe('Benefit category (Food, Entertainment, Services, Fuel) | Categoría de beneficio (Alimentación, Entretenimiento, Servicios, Combustible)') },
- src/tools/insurance.ts:83-85 (registration)Registration of the 'get-benefits' tool on the MCP server, specifying name, description, and referencing schema and handler.server.tool( 'get-benefits', 'Get available benefits and discounts for financial product users. | Obtener beneficios y descuentos disponibles para usuarios de productos financieros.',
- src/tools/insurance.ts:22-28 (helper)Helper function getBenefits() that calls the API fetchBenefits() and extracts the benefits array./** * Fetch benefits from API */ async function getBenefits(): Promise<Benefit[]> { const response = await fetchBenefits(); return response.benefits; }
- src/api/client.ts:209-213 (helper)Core API fetch function for benefits data from '/api/v1/benefits' endpoint.*/ export async function fetchBenefits(): Promise<BenefitsResponse> { const response = await apiClient.get<BenefitsResponse>('/api/v1/benefits'); return response.data; }