search-insurances
Search and compare available insurance options in Uruguay, including life, auto, and home coverage, to find suitable protection plans.
Instructions
Search available insurance in Uruguay. Includes life, auto, home insurance and more. | Buscar seguros disponibles en Uruguay. Incluye seguros de vida, auto, hogar y más.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Insurance type (life, auto, home) | Tipo de seguro (vida, auto, hogar) |
Implementation Reference
- src/tools/insurance.ts:31-60 (registration)Registration of the 'search-insurances' MCP tool using server.tool(). Includes bilingual description, optional input schema for 'type' (zod), and inline handler that fetches, optionally filters by type, and returns structured JSON as text content.// Tool: search-insurances server.tool( 'search-insurances', 'Search available insurance in Uruguay. Includes life, auto, home insurance and more. | Buscar seguros disponibles en Uruguay. Incluye seguros de vida, auto, hogar y más.', { type: z.string().optional().describe('Insurance type (life, auto, home) | Tipo de seguro (vida, auto, hogar)') }, async ({ type }) => { const insurances = await getInsurances(); let filteredInsurances = [...insurances]; if (type) { const searchType = type.toLowerCase(); filteredInsurances = filteredInsurances.filter(ins => ins.type.toLowerCase().includes(searchType) ); } return { content: [{ type: 'text' as const, text: JSON.stringify({ insurances: filteredInsurances, count: filteredInsurances.length, availableTypes: [...new Set(insurances.map(i => i.type))] }, null, 2) }] }; } );
- src/tools/insurance.ts:9-12 (helper)Helper function called by the search-insurances handler to retrieve the list of insurances from the API.async function getInsurances(): Promise<Insurance[]> { const response = await fetchInsurances(); return response.insurances; }
- src/tools/index.ts:9-9 (registration)Intermediate registration call within registerAllTools that invokes the insurance tools registration, including search-insurances.registerInsuranceTools(server);
- src/server.ts:16-16 (registration)Top-level server initialization calls registerAllTools, which chains to registration of search-insurances tool.registerAllTools(server);