Data source: Lovdata (lovdata.no)
Overview
Lovdata (Norwegian Law) wraps Lovdata (lovdata.no), handling authentication, pagination, and rate limits for you. This tutorial covers all 5 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-lovdata": {
"url": "https://context.gnist.ai/mcp/lovdata/",
"headers": {
"Gnist-API-Key": "YOUR_API_KEY"
}
}
}
}
Tools (5)
search_legislation
Search Norwegian laws and regulations on Lovdata. Lovdata is Norway's official source for legislation, including laws (lover), regulations (forskrifter), and court decisions. Args: query: Search term — law name, topic, or keyword. doc_type: Document type to search: 'lover' (laws, default) or 'forskrifter' (regulations). max_results: Maximum results (1-50, default 20). Returns: Dict with 'query', 'count', and 'results' list. Each result has: title, identifier, url, date, department.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | required | Search term — law name, topic, or keyword. |
doc_type | any | optional | Document type to search: 'lover' (laws, default) or 'forskrifter' (regulations). (default: lover) |
max_results | integer | optional | Maximum results (1-50, default 20). (default: 20) |
curl -X POST "https://context.gnist.ai/mcp/lovdata/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "search_legislation", "arguments": {"query": "renewable energy"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/lovdata/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'query': 'renewable energy'},
'name': 'search_legislation'}},
)
print(resp.json())
get_law
Get an overview of a Norwegian law, including title, metadata, and table of contents. Args: law_path: The law's date-number identifier, e.g. '1997-06-13-44' for aksjeloven (Company Act) or '2005-06-17-62' for arbeidsmiljøloven (Working Environment Act). Returns: Dict with title, short_title, identifier, department, url, and chapters list. Each chapter has: chapter_id, title, and sections list.
| Parameter | Type | Required | Description |
|---|---|---|---|
law_path | string | required | The law's date-number identifier, e.g. '1997-06-13-44' for aksjeloven (Company Act) or '2005-06-17-62' for arbeidsmiljøloven (Working Environment Act). |
curl -X POST "https://context.gnist.ai/mcp/lovdata/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_law", "arguments": {"law_path": "'1997-06-13-44'"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/lovdata/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'law_path': "'1997-06-13-44'"}, 'name': 'get_law'}},
)
print(resp.json())
get_law_section
Get the full text of a specific section (paragraph) of a Norwegian law. Args: law_path: The law's date-number identifier, e.g. '1997-06-13-44' for aksjeloven. section: Section number, e.g. '1-1' or '3-4'. The § symbol is optional. Returns: Dict with section_id, title, content (full text), and url.
| Parameter | Type | Required | Description |
|---|---|---|---|
law_path | string | required | The law's date-number identifier, e.g. '1997-06-13-44' for aksjeloven. |
section | string | required | Section number, e.g. '1-1' or '3-4'. The § symbol is optional. |
curl -X POST "https://context.gnist.ai/mcp/lovdata/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_law_section", "arguments": {"law_path": "'1997-06-13-44'", "section": "'1-1'"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/lovdata/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'law_path': "'1997-06-13-44'", 'section': "'1-1'"},
'name': 'get_law_section'}},
)
print(resp.json())
get_regulation
Get an overview of a Norwegian regulation (forskrift). Args: regulation_path: The regulation's date-number identifier, e.g. '2019-12-09-1698' for a specific regulation. Returns: Dict with title, identifier, department, url, and chapters list.
| Parameter | Type | Required | Description |
|---|---|---|---|
regulation_path | string | required | The regulation's date-number identifier, e.g. '2019-12-09-1698' for a specific regulation. |
curl -X POST "https://context.gnist.ai/mcp/lovdata/" \
-H "Content-Type: application/json" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_regulation", "arguments": {"regulation_path": "'2019-12-09-1698'"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/lovdata/",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
json={'id': 1,
'jsonrpc': '2.0',
'method': 'tools/call',
'params': {'arguments': {'regulation_path': "'2019-12-09-1698'"},
'name': 'get_regulation'}},
)
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/lovdata/" \
-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/lovdata/",
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_legislation to find items, then get_law 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 Lovdata (Norwegian Law) provide?
Norwegian laws (lover) and regulations (forskrifter) — search legislation, read law text, browse sections. It exposes 5 tools: search_legislation, get_law, get_law_section, get_regulation, 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 Lovdata (Norwegian Law) API return?
JSON, via either MCP protocol (JSON-RPC 2.0) or REST API.