Skip to main content
Glama

get_price_history

Track Swiss health insurance premium changes over time by insurer, canton, age group, and franchise amount to analyze cost trends and make informed coverage decisions.

Instructions

Zeigt die Preisentwicklung eines Versicherers über mehrere Jahre.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
insurer_nameYesName des Versicherers (z.B. 'CSS', 'Helsana')
cantonYesKanton (2-Buchstaben-Code)
age_bandYesAltersgruppe
franchise_chfYesFranchise in CHF
start_yearNoStartjahr (optional, default: 2016)
end_yearNoEndjahr (optional, default: 2026)

Implementation Reference

  • The core handler function that executes the get_price_history tool logic. It resolves insurer IDs, queries the Supabase database for premiums across specified years, selects the cheapest premium per year, formats the price history output, and includes a percentage change calculation.
    async function getPriceHistory(params: { insurer_name: string; canton: string; age_band: string; franchise_chf: number; start_year?: number; end_year?: number; }): Promise<string> { const db = getSupabase(); const { insurer_name, canton, age_band, franchise_chf, start_year = 2016, end_year = 2026 } = params; // Finde ALLE Versicherer-IDs (z.B. CSS hat 0008 und 1507) const insurerIds = findAllInsurerIds(insurer_name); const primaryId = findInsurerIdByName(insurer_name); if (insurerIds.length === 0 || !primaryId) { return `⚠️ Versicherer "${insurer_name}" nicht gefunden\n\nVerfügbare Versicherer: CSS, Helsana, Swica, Assura, Concordia, Sanitas, KPT, ÖKK, Visana, Groupe Mutuel, Sympany, Atupri, EGK, Aquilana, Galenos`; } const insurerDisplayName = getInsurerName(primaryId); // Hole Prämien über die Jahre für ALLE IDs des Versicherers const { data: premiums, error } = await db .from("premiums") .select("year, monthly_premium_chf, model_type, insurer_id") .in("insurer_id", insurerIds) .eq("canton", canton.toUpperCase()) .eq("age_band", age_band) .eq("franchise_chf", franchise_chf) .gte("year", start_year) .lte("year", end_year) .order("year", { ascending: true }); if (error || !premiums || premiums.length === 0) { return `❌ Keine Daten für ${insurerDisplayName} in ${canton} (IDs: ${insurerIds.join(", ")})`; } // Gruppiere nach Jahr (günstigster Tarif pro Jahr) const bestByYear = new Map<number, number>(); for (const p of premiums) { const existing = bestByYear.get(p.year); if (!existing || p.monthly_premium_chf < existing) { bestByYear.set(p.year, p.monthly_premium_chf); } } // Formatiere Ergebnis let result = `📈 Preisentwicklung: ${insurerDisplayName}\n`; result += `📍 ${canton} | ${age_band} | CHF ${franchise_chf} Franchise\n\n`; const sortedYears = [...bestByYear.entries()].sort((a, b) => a[0] - b[0]); sortedYears.forEach(([year, premium]) => { result += `${year}: CHF ${premium.toFixed(2)}/Monat\n`; }); if (sortedYears.length >= 2) { const first = sortedYears[0][1]; const last = sortedYears[sortedYears.length - 1][1]; const change = ((last - first) / first * 100).toFixed(1); result += `\n📊 Veränderung ${sortedYears[0][0]}-${sortedYears[sortedYears.length - 1][0]}: ${change}%\n`; } result += DISCLAIMER; return result; }
  • Input schema definition for the get_price_history tool, specifying parameters, types, descriptions, enums, and required fields.
    inputSchema: { type: "object" as const, properties: { insurer_name: { type: "string", description: "Name des Versicherers (z.B. 'CSS', 'Helsana')" }, canton: { type: "string", description: "Kanton (2-Buchstaben-Code)" }, age_band: { type: "string", enum: ["child", "young_adult", "adult"], description: "Altersgruppe" }, franchise_chf: { type: "number", description: "Franchise in CHF" }, start_year: { type: "number", description: "Startjahr (optional, default: 2016)" }, end_year: { type: "number", description: "Endjahr (optional, default: 2026)" } }, required: ["insurer_name", "canton", "age_band", "franchise_chf"] }
  • src/index.ts:174-189 (registration)
    Tool registration object in the TOOLS array, which is returned by the ListToolsRequestHandler. Includes name, description, and input schema.
    { name: "get_price_history", description: "Zeigt die Preisentwicklung eines Versicherers über mehrere Jahre.", inputSchema: { type: "object" as const, properties: { insurer_name: { type: "string", description: "Name des Versicherers (z.B. 'CSS', 'Helsana')" }, canton: { type: "string", description: "Kanton (2-Buchstaben-Code)" }, age_band: { type: "string", enum: ["child", "young_adult", "adult"], description: "Altersgruppe" }, franchise_chf: { type: "number", description: "Franchise in CHF" }, start_year: { type: "number", description: "Startjahr (optional, default: 2016)" }, end_year: { type: "number", description: "Endjahr (optional, default: 2026)" } }, required: ["insurer_name", "canton", "age_band", "franchise_chf"] } },
  • src/index.ts:501-503 (registration)
    Dispatch/registration case in the switch statement of the CallToolRequestHandler that invokes the getPriceHistory handler when the tool name matches.
    case "get_price_history": result = await getPriceHistory(args as any); break;

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/remoprinz/swiss-health-mcp'

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