get_entity_updates
Retrieve recent changes to Norwegian business entities from the official registry to maintain an updated local copy of company information.
Instructions
Get updates on entities for maintaining a local copy of the registry
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dato | No | Show updates from this timestamp (ISO-8601) | |
| oppdateringsid | No | Show updates from this update ID | |
| organisasjonsnummer | No | Filter by organization numbers | |
| page | No | Page number | |
| size | No | Page size (default 20, max 10000) | |
| sort | No | Sort by ID (ASC/DESC) |
Input Schema (JSON Schema)
{
"properties": {
"dato": {
"description": "Show updates from this timestamp (ISO-8601)",
"type": "string"
},
"oppdateringsid": {
"description": "Show updates from this update ID",
"type": "string"
},
"organisasjonsnummer": {
"description": "Filter by organization numbers",
"items": {
"type": "string"
},
"type": "array"
},
"page": {
"description": "Page number",
"type": "number"
},
"size": {
"description": "Page size (default 20, max 10000)",
"type": "number"
},
"sort": {
"description": "Sort by ID (ASC/DESC)",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/brreg-mcp-server.ts:115-124 (handler)Core handler function in BrregApiClient that fetches entity updates from the BRREG API endpoint using the shared makeRequest method.async getEntityUpdates(params: { dato?: string; oppdateringsid?: string; organisasjonsnummer?: string[]; page?: number; size?: number; sort?: string; } = {}) { return this.makeRequest('/enhetsregisteret/api/oppdateringer/enheter', params); }
- src/brreg-mcp-server.ts:506-515 (handler)MCP CallToolRequest handler case that invokes the apiClient.getEntityUpdates method and formats the response as JSON text content.case "get_entity_updates": const entityUpdates = await apiClient.getEntityUpdates(request.params.arguments as any); return { content: [ { type: "text", text: JSON.stringify(entityUpdates, null, 2), }, ], };
- src/brreg-mcp-server.ts:318-332 (registration)Tool registration in the ListTools response, including name, description, and input schema definition.{ name: "get_entity_updates", description: "Get updates on entities for maintaining a local copy of the registry", inputSchema: { type: "object", properties: { dato: { type: "string", description: "Show updates from this timestamp (ISO-8601)" }, oppdateringsid: { type: "string", description: "Show updates from this update ID" }, organisasjonsnummer: { type: "array", items: { type: "string" }, description: "Filter by organization numbers" }, page: { type: "number", description: "Page number" }, size: { type: "number", description: "Page size (default 20, max 10000)" }, sort: { type: "string", description: "Sort by ID (ASC/DESC)" } } } },
- src/brreg-mcp-server.ts:322-331 (schema)Input schema definition for the get_entity_updates tool parameters.type: "object", properties: { dato: { type: "string", description: "Show updates from this timestamp (ISO-8601)" }, oppdateringsid: { type: "string", description: "Show updates from this update ID" }, organisasjonsnummer: { type: "array", items: { type: "string" }, description: "Filter by organization numbers" }, page: { type: "number", description: "Page number" }, size: { type: "number", description: "Page size (default 20, max 10000)" }, sort: { type: "string", description: "Sort by ID (ASC/DESC)" } } }
- src/brreg-mcp-server.ts:48-77 (helper)Shared helper method used by all API client methods, including getEntityUpdates, to construct URL query params and perform fetch requests to BRREG API.private async makeRequest(endpoint: string, params?: Record<string, any>): Promise<any> { const url = new URL(`${BASE_URL}${endpoint}`); if (params) { Object.entries(params).forEach(([key, value]) => { if (value !== undefined && value !== null) { if (Array.isArray(value)) { url.searchParams.set(key, value.join(',')); } else { url.searchParams.set(key, String(value)); } } }); } const response = await fetch(url.toString(), { headers: { 'Accept': 'application/json', }, }); if (!response.ok) { if (response.status === 404) { throw new McpError(ErrorCode.InvalidRequest, `Resource not found: ${endpoint}`); } throw new McpError(ErrorCode.InternalError, `API request failed: ${response.status} ${response.statusText}`); } return response.json(); }