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
| Name | Required | Description | Default |
|---|---|---|---|
| affair_id | Yes | OpenParlData affair ID (get from search_parliament_business results) |
Implementation Reference
- src/modules/parliament.ts:374-403 (handler)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, }) ); } - src/modules/parliament.ts:104-117 (schema)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)", }, }, }, - src/modules/parliament.ts:684-685 (registration)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 });