Skip to main content
Glama

is_holiday_today

Check if today is a Swiss public holiday, optionally by canton, and get the holiday name if applicable.

Instructions

Check whether today is a Swiss public holiday, optionally for a specific canton. Returns the holiday name if it is one.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cantonNoTwo-letter canton code (e.g. ZH, BE, GE). If omitted, checks nationwide holidays only.

Implementation Reference

  • The handler implementation for the `is_holiday_today` tool. It queries the OpenHolidays API for the current date, optionally filtering by canton, and returns whether it's a holiday.
    case "is_holiday_today": {
      const canton = args.canton as string | undefined;
      const today = new Date().toISOString().slice(0, 10); // YYYY-MM-DD
    
      const params: Record<string, string> = {
        countryIsoCode: "CH",
        languageIsoCode: "EN",
        validFrom: today,
        validTo: today,
      };
      if (canton) {
        params.subdivisionCode = toSubdivisionCode(canton);
      }
    
      const url = buildUrl(`${BASE}/PublicHolidays`, params);
      const data = await fetchJSON<Holiday[]>(url);
    
      if (data.length === 0) {
        return JSON.stringify({
          date: today,
          is_holiday: false,
          canton: canton ?? "all",
        });
      }
    
      // Return the first (or nationwide) match
      const nationwide = data.find((h) => h.nationwide);
      const match = nationwide ?? data[0];
      return JSON.stringify({
        date: today,
        is_holiday: true,
        holiday: extractName(match.name),
        type: match.type,
        nationwide: match.nationwide,
        canton: canton ?? "all",
      });
    }
  • The tool registration and schema definition for `is_holiday_today`.
      name: "is_holiday_today",
      description:
        "Check whether today is a Swiss public holiday, optionally for a specific canton. Returns the holiday name if it is one.",
      inputSchema: {
        type: "object",
        properties: {
          canton: {
            type: "string",
            description:
              "Two-letter canton code (e.g. ZH, BE, GE). If omitted, checks nationwide holidays only.",
          },
        },
      },
    },

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

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