get_public_holidays
Retrieve Swiss public holidays for any year, with optional canton filtering to get national and regional holiday data.
Instructions
Get Swiss public holidays for a given year, optionally filtered by canton (e.g. ZH, BE, GE). Returns national and canton-specific holidays.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| year | Yes | Year (e.g. 2026) | |
| canton | No | Two-letter canton code (e.g. ZH, BE, GE, BS, TI). If omitted, returns all Swiss holidays. |
Implementation Reference
- src/modules/holidays.ts:121-146 (handler)Handler logic for the get_public_holidays tool.
case "get_public_holidays": { const year = args.year as number; const canton = args.canton as string | undefined; const params: Record<string, string> = { countryIsoCode: "CH", languageIsoCode: "EN", validFrom: `${year}-01-01`, validTo: `${year}-12-31`, }; if (canton) { params.subdivisionCode = toSubdivisionCode(canton); } const url = buildUrl(`${BASE}/PublicHolidays`, params); const data = await fetchJSON<Holiday[]>(url); const holidays = data.map(compactHoliday); return JSON.stringify({ year, canton: canton ?? "all", count: holidays.length, holidays, source: "openholidaysapi.org", }); } - src/modules/holidays.ts:31-48 (schema)Tool definition and input schema for get_public_holidays.
export const holidaysTools = [ { name: "get_public_holidays", description: "Get Swiss public holidays for a given year, optionally filtered by canton (e.g. ZH, BE, GE). Returns national and canton-specific holidays.", inputSchema: { type: "object", required: ["year"], properties: { year: { type: "number", description: "Year (e.g. 2026)" }, canton: { type: "string", description: "Two-letter canton code (e.g. ZH, BE, GE, BS, TI). If omitted, returns all Swiss holidays.", }, }, }, },