Skip to main content
Glama

get_parliament_votes

Retrieve voting results for Swiss parliamentary affairs using OpenParlData. Enter an affair ID to access all recorded votes for specific legislative matters.

Instructions

Get voting results for a specific parliamentary affair (Geschäft). Returns all recorded votes for the given affair ID from OpenParlData.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
affair_idYesOpenParlData affair ID (get from search_parliament_business results)

Implementation Reference

  • The getParliamentVotes function implements the business logic for retrieving parliamentary vote records for a given affair_id.
    async function getParliamentVotes(args: {
      affair_id: number;
    }): Promise<string> {
      const url = buildUrl(`/affairs/${args.affair_id}/votings`, {
        lang: "de",
        lang_format: "flat",
      });
      const resp = await apiFetch<VotingRecord>(url);
    
      const votes = resp.data.map((v) => ({
        id: v.id,
        affairId: v.affair_id,
        subject: v.subject_de,
        meaningYes: v.meaning_yes_de,
        meaningNo: v.meaning_no_de,
        yes: v.total_yes,
        no: v.total_no,
        abstain: v.total_abstain,
        absent: v.total_absent,
        date: v.vote_date ? v.vote_date.split("T")[0] : null,
      }));
    
      return truncate(
        JSON.stringify({
          count: votes.length,
          affairId: args.affair_id,
          votes,
        })
      );
    }
  • Tool definition and input schema registration for get_parliament_votes.
    name: "get_parliament_votes",
    description:
      "Get voting results for a specific parliamentary affair (Geschäft). Returns all recorded votes for the given affair ID from OpenParlData.",
    inputSchema: {
      type: "object" as const,
      required: ["affair_id"],
      properties: {
        affair_id: {
          type: "number",
          description:
            "OpenParlData affair ID (get from search_parliament_business results)",
        },
      },
    },
  • Request handling switch case that dispatches calls to get_parliament_votes to the implementation function.
    case "get_parliament_votes":
      return getParliamentVotes(args as { affair_id: 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