Data source: Riksdagen (data.riksdagen.se)
Overview
Riksdagen (Swedish Parliament) wraps Riksdagen (data.riksdagen.se), handling authentication, pagination, and rate limits for you. This tutorial covers all 7 tools with working code examples you can copy and run.
Prerequisites
- Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
- Choose your integration method: MCP protocol or REST API.
Connect via MCP
Add to your MCP client config (Claude Desktop, Cursor, etc.):
{
"mcpServers": {
"gnist-riksdagen": {
"url": "https://context.gnist.ai/mcp/riksdagen/",
"headers": {
"Gnist-API-Key": "YOUR_API_KEY"
}
}
}
}
Tools (7)
search_documents
Search Swedish parliamentary documents — bills, motions, committee reports, and more. Query the Riksdagen (Swedish Parliament) document archive with full-text search and structured filters. The archive contains 600K+ documents dating back decades. Returns: Dict with 'count', 'total', 'page', 'pages', and 'documents' list.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | any | optional | Free-text search term |
doc_type | any | optional | Document type code: 'prop' (proposition/bill), 'mot' (motion), 'bet' (committee report), 'skr' (government communication), 'sou' (inquiry report) |
committee | any | optional | Committee code: 'FiU' (Finance), 'AU' (Labour), 'JuU' (Justice), 'SoU' (Social), 'UU' (Foreign Affairs), etc. |
session | any | optional | Parliament session, e.g. '2025/26'. Format: YYYY/YY |
page | integer | optional | Page number (default 1) (default: 1) |
curl -X POST "https://context.gnist.ai/mcp/riksdagen/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "search_documents", "arguments": {"query": "renewable energy"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/riksdagen/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'query': 'renewable energy'},
'name': 'search_documents'}},
)
print(resp.json())
get_document
Get full details for a specific Swedish parliamentary document. Retrieves the complete document including metadata and (where available) HTML content. Returns: Document detail dict, or error if not found.
| Parameter | Type | Required | Description |
|---|---|---|---|
dok_id | string | required | Document ID from search results (e.g. 'HD01FiU1') |
curl -X POST "https://context.gnist.ai/mcp/riksdagen/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_document", "arguments": {"dok_id": "'HD01FiU1'"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/riksdagen/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'dok_id': "'HD01FiU1'"}, 'name': 'get_document'}},
)
print(resp.json())
list_votes
List parliamentary votes in the Swedish Riksdagen. Each record represents one member's vote on one ballot point. Filter by session and/or document to narrow results. Returns: Dict with 'count' and 'votes' list containing individual member votes.
| Parameter | Type | Required | Description |
|---|---|---|---|
session | any | optional | Parliament session, e.g. '2025/26'. Format: YYYY/YY |
doc_id | any | optional | Filter votes for a specific document designation (e.g. 'FiU1') |
curl -X POST "https://context.gnist.ai/mcp/riksdagen/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "list_votes", "arguments": {"session": "'2025/26'"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/riksdagen/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'session': "'2025/26'"}, 'name': 'list_votes'}},
)
print(resp.json())
get_vote_detail
Get full voting detail with individual member votes for a specific ballot. Returns the document context and every member's vote (Ja/Nej/Avstår/Frånvarande). Returns: Dict with document info and 'votes' list, or error if not found.
| Parameter | Type | Required | Description |
|---|---|---|---|
votering_id | string | required | Vote ID from vote list (e.g. '2025/26:FiU1:1') |
curl -X POST "https://context.gnist.ai/mcp/riksdagen/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_vote_detail", "arguments": {"votering_id": "'2025/26:FiU1:1'"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/riksdagen/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'votering_id': "'2025/26:FiU1:1'"},
'name': 'get_vote_detail'}},
)
print(resp.json())
search_members
Search members of the Swedish Parliament (Riksdagen). Returns current members by default. Use status='samtliga' to include all historical members (2700+ total). Returns: Dict with 'count', 'total', and 'members' list with party, constituency, assignments.
| Parameter | Type | Required | Description |
|---|---|---|---|
status | any | optional | Member status: omit for current members, 'samtliga' for all historical members |
party | any | optional | Party code: 'S' (Social Democrats), 'M' (Moderates), 'SD' (Sweden Democrats), 'C' (Centre), 'V' (Left), 'KD' (Christian Democrats), 'L' (Liberals), 'MP' (Green) |
limit | integer | optional | Max results to return (default 50) (default: 50) |
curl -X POST "https://context.gnist.ai/mcp/riksdagen/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "search_members", "arguments": {"status": "example"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/riksdagen/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'status': 'example'}, 'name': 'search_members'}},
)
print(resp.json())
get_member
Get full details for a specific member of the Swedish Parliament. Returns personal information, party affiliation, constituency, and complete assignment history (committee roles, etc.). Returns: Member detail dict, or error if not found.
| Parameter | Type | Required | Description |
|---|---|---|---|
person_id | string | required | Member source ID from search results |
curl -X POST "https://context.gnist.ai/mcp/riksdagen/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_member", "arguments": {"person_id": "12345"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/riksdagen/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'person_id': '12345'}, 'name': 'get_member'}},
)
print(resp.json())
report_feedback
Report a bug, feature request, or general feedback for this data source. Use this when something doesn't work as expected, when you'd like a new feature, or when you have suggestions for improvement. Args: feedback: Describe the issue or suggestion. feedback_type: One of 'bug', 'feature_request', or 'general'.
| Parameter | Type | Required | Description |
|---|---|---|---|
feedback | string | required | |
feedback_type | string | optional | (default: general) |
curl -X POST "https://context.gnist.ai/mcp/riksdagen/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "report_feedback", "arguments": {"feedback": "example"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/riksdagen/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'feedback': 'example'}, 'name': 'report_feedback'}},
)
print(resp.json())
Common Patterns
Use
search_documents to find items, then get_document to get full details. This two-step pattern is common for exploring data before drilling down.Several tools support
limit, offset, or page parameters. Start with small limits during development, then increase for production queries.FAQ
What data does Riksdagen (Swedish Parliament) provide?
Swedish Parliament data — document search, committee reports, bills, motions, vote records, and member profiles. It exposes 7 tools: search_documents, get_document, list_votes, get_vote_detail, search_members, get_member, report_feedback.
What do I need to get started?
A Gnist API key (free tier: 100 calls/day). Sign up at https://context.gnist.ai/signup.
What format does the Riksdagen (Swedish Parliament) API return?
JSON, via either MCP protocol (JSON-RPC 2.0) or REST API.