get_role_updates
Retrieve role change notifications for Norwegian companies to monitor board member and governance updates in real-time.
Instructions
Get role updates for entities
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| afterTime | No | Get events after this timestamp (ISO-8601) | |
| afterId | No | Get events after this ID | |
| organisasjonsnummer | No | Filter by organization numbers | |
| size | No | Number of events to retrieve (default 100, max 10000) |
Implementation Reference
- src/brreg-mcp-server.ts:137-144 (handler)Core implementation of get_role_updates tool: fetches role updates from BRREG API endpoint '/enhetsregisteret/api/oppdateringer/roller' using the shared makeRequest method.async getRoleUpdates(params: { afterTime?: string; afterId?: number; organisasjonsnummer?: string[]; size?: number; } = {}) { return this.makeRequest('/enhetsregisteret/api/oppdateringer/roller', params); }
- src/brreg-mcp-server.ts:348-360 (registration)Registers the get_role_updates tool in the ListTools response with name, description, and input schema.{ name: "get_role_updates", description: "Get role updates for entities", inputSchema: { type: "object", properties: { afterTime: { type: "string", description: "Get events after this timestamp (ISO-8601)" }, afterId: { type: "number", description: "Get events after this ID" }, organisasjonsnummer: { type: "array", items: { type: "string" }, description: "Filter by organization numbers" }, size: { type: "number", description: "Number of events to retrieve (default 100, max 10000)" } } } },
- src/brreg-mcp-server.ts:528-537 (handler)MCP CallToolRequest handler case for get_role_updates: calls BrregApiClient.getRoleUpdates and formats response as JSON text.case "get_role_updates": const roleUpdates = await apiClient.getRoleUpdates(request.params.arguments as any); return { content: [ { type: "text", text: JSON.stringify(roleUpdates, null, 2), }, ], };
- src/brreg-mcp-server.ts:48-77 (helper)Shared helper method used by getRoleUpdates (and other tools) to make HTTP requests to BRREG API, handling params, fetch, and errors.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(); }