Skip to main content
Glama
reidar80

Norwegian Business Registry MCP Server

by reidar80

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
NameRequiredDescriptionDefault
afterTimeNoGet events after this timestamp (ISO-8601)
afterIdNoGet events after this ID
organisasjonsnummerNoFilter by organization numbers
sizeNoNumber of events to retrieve (default 100, max 10000)

Implementation Reference

  • 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);
    }
  • 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)" }
        }
      }
    },
  • 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),
          },
        ],
      };
  • 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();
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/reidar80/BRREG-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server