get_parliamentary_documents
Retrieve official parliamentary documents including reports, committee opinions, and federal council statements for Swiss legislative affairs using OpenParlData affair IDs.
Instructions
Get official documents for a parliamentary affair — reports, committee opinions, federal council statements.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| affair_id | Yes | OpenParlData affair ID (get from search_parliament_business results) | |
| limit | No | Max documents to return (default: 5, max: 20) |
Implementation Reference
- src/modules/parliament.ts:596-625 (handler)The handler function that fetches parliamentary documents for a given affair_id from the OpenParlData API.
async function getParliamentaryDocuments(args: { affair_id: number; limit?: number; }): Promise<string> { const limit = Math.min(args.limit ?? 5, 20); const url = buildUrl(`/affairs/${args.affair_id}/docs`, { lang: "de", lang_format: "flat", limit, }); const resp = await apiFetch<DocRecord>(url); const docs = resp.data.map((d) => ({ id: d.id, title: d.title_de, type: d.type_de, url: d.url_external, filename: d.filename, date: d.date ? d.date.split("T")[0] : null, })); return truncate( JSON.stringify({ count: docs.length, total: resp.meta.total_records, affairId: args.affair_id, documents: docs, }) ); } - src/modules/parliament.ts:194-212 (schema)The tool definition and input schema for get_parliamentary_documents.
name: "get_parliamentary_documents", description: "Get official documents for a parliamentary affair — reports, committee opinions, federal council statements.", inputSchema: { type: "object" as const, required: ["affair_id"], properties: { affair_id: { type: "number", description: "OpenParlData affair ID (get from search_parliament_business results)", }, limit: { type: "number", description: "Max documents to return (default: 5, max: 20)", }, }, }, }, - src/modules/parliament.ts:698-701 (registration)Registration in the main dispatcher for the get_parliamentary_documents tool.
case "get_parliamentary_documents": return getParliamentaryDocuments( args as { affair_id: number; limit?: number } );