Skip to main content
Glama

search_cantonal_affairs

Search political affairs across all 26 Swiss cantonal parliaments using OpenParlData. Find parliamentary discussions by canton and topic.

Instructions

Search political affairs across Swiss cantonal parliaments (Kantonsräte). Covers all 26 cantons via OpenParlData.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cantonYesCanton abbreviation: ZH, BE, LU, UR, SZ, OW, NW, GL, ZG, FR, SO, BS, BL, SH, AR, AI, SG, GR, AG, TG, TI, VD, VS, NE, GE, JU
queryNoSearch term (optional, e.g. 'Bildung', 'Verkehr')
limitNoMax results (default: 5, max: 20)

Implementation Reference

  • The searchCantonalAffairs function handles the logic for searching cantonal parliamentary affairs using the OpenParlData API.
    async function searchCantonalAffairs(args: {
      canton: string;
      query?: string;
      limit?: number;
    }): Promise<string> {
      const limit = Math.min(args.limit ?? 5, 20);
      const params: Record<string, string | number | boolean | undefined> = {
        body_key: args.canton.toUpperCase(),
        lang: "de",
        lang_format: "flat",
        sort_by: "-begin_date",
        limit,
      };
      if (args.query) {
        params.search = args.query;
      }
    
      const url = buildUrl("/affairs/", params);
      const resp = await apiFetch<AffairRecord>(url);
    
      const affairs = resp.data.map((a) => ({
        id: a.id,
        number: a.number,
        title: a.title_de,
        type: a.type_name_de,
        typeCategory: a.type_harmonized_de,
        status: a.state_name_de,
        date: a.begin_date ? a.begin_date.split("T")[0] : null,
        canton: a.body_key,
        url: a.url_external_de,
      }));
    
      return truncate(
        JSON.stringify({
          count: affairs.length,
          total: resp.meta.total_records,
          canton: args.canton.toUpperCase(),
          query: args.query || null,
          affairs,
        })
      );
    }
  • The input schema definition for the search_cantonal_affairs tool.
    {
      name: "search_cantonal_affairs",
      description:
        "Search political affairs across Swiss cantonal parliaments (Kantonsräte). Covers all 26 cantons via OpenParlData.",
      inputSchema: {
        type: "object" as const,
        required: ["canton"],
        properties: {
          canton: {
            type: "string",
            description:
              "Canton abbreviation: ZH, BE, LU, UR, SZ, OW, NW, GL, ZG, FR, SO, BS, BL, SH, AR, AI, SG, GR, AG, TG, TI, VD, VS, NE, GE, JU",
          },
          query: {
            type: "string",
            description: "Search term (optional, e.g. 'Bildung', 'Verkehr')",
          },
          limit: {
            type: "number",
            description: "Max results (default: 5, max: 20)",
          },
        },
      },
    },
  • The tool registration and invocation dispatcher in handleParliament.
    case "search_cantonal_affairs":
      return searchCantonalAffairs(
        args as { canton: string; query?: string; limit?: number }
      );

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