get_entity
Retrieve detailed information about Norwegian businesses using their 9-digit organization number, including company data, board members, and corporate structure.
Instructions
Get detailed information about a specific Norwegian business entity
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organisasjonsnummer | Yes | 9-digit organization number |
Implementation Reference
- src/brreg-mcp-server.ts:413-423 (handler)MCP tool handler for 'get_entity': extracts organisasjonsnummer from arguments, calls apiClient.getEntity(), formats response as JSON text content.case "get_entity": const { organisasjonsnummer } = request.params.arguments as { organisasjonsnummer: string }; const entity = await apiClient.getEntity(organisasjonsnummer); return { content: [ { type: "text", text: JSON.stringify(entity, null, 2), }, ], };
- src/brreg-mcp-server.ts:83-85 (helper)BrregApiClient method implementing the core logic: constructs BRREG API URL for specific entity and fetches data via makeRequest.async getEntity(orgNumber: string) { return this.makeRequest(`/enhetsregisteret/api/enheter/${orgNumber}`); }
- src/brreg-mcp-server.ts:210-220 (registration)Registers the 'get_entity' tool in the MCP server's list of tools, including name, description, and input schema.{ name: "get_entity", description: "Get detailed information about a specific Norwegian business entity", inputSchema: { type: "object", properties: { organisasjonsnummer: { type: "string", description: "9-digit organization number" } }, required: ["organisasjonsnummer"] } },
- src/brreg-mcp-server.ts:213-219 (schema)Input schema defining the required 'organisasjonsnummer' parameter (string, 9-digit org number) for the get_entity tool.inputSchema: { type: "object", properties: { organisasjonsnummer: { type: "string", description: "9-digit organization number" } }, required: ["organisasjonsnummer"] }
- src/brreg-mcp-server.ts:48-77 (helper)Shared helper method in BrregApiClient for making HTTP requests to BRREG API, handling query params, fetch, error handling, and JSON parsing.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(); }