get_municipalities
Retrieve and list all Norwegian municipalities with options to sort results and paginate through the data for efficient access to regional administrative divisions.
Instructions
Get all Norwegian municipalities
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number | |
| size | No | Page size | |
| sort | No | Sort order |
Input Schema (JSON Schema)
{
"properties": {
"page": {
"description": "Page number",
"type": "number"
},
"size": {
"description": "Page size",
"type": "number"
},
"sort": {
"description": "Sort order",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/brreg-mcp-server.ts:483-492 (handler)The MCP tool handler for 'get_municipalities' which invokes the API client method and returns the result as formatted JSON text content.case "get_municipalities": const municipalities = await apiClient.getMunicipalities(); return { content: [ { type: "text", text: JSON.stringify(municipalities, null, 2), }, ], };
- src/brreg-mcp-server.ts:295-306 (registration)Registration of the 'get_municipalities' tool in the list of tools, including name, description, and input schema definition.{ name: "get_municipalities", description: "Get all Norwegian municipalities", inputSchema: { type: "object", properties: { sort: { type: "string", description: "Sort order" }, size: { type: "number", description: "Page size" }, page: { type: "number", description: "Page number" } } } },
- src/brreg-mcp-server.ts:107-109 (helper)The BrregApiClient helper method implementing the core logic: makes an HTTP request to the BRREG API endpoint for municipalities.async getMunicipalities() { return this.makeRequest('/enhetsregisteret/api/kommuner'); }
- src/brreg-mcp-server.ts:298-305 (schema)Input schema for the 'get_municipalities' tool defining optional pagination and sorting parameters.inputSchema: { type: "object", properties: { sort: { type: "string", description: "Sort order" }, size: { type: "number", description: "Page size" }, page: { type: "number", description: "Page number" } } }