search_sub_entities
Search for Norwegian business sub-entities (underenheter) using filters like name, organization number, parent entity, employee count, registration dates, industry codes, and organizational forms to find specific subsidiaries or branches.
Instructions
Search for Norwegian business sub-entities (underenheter) with various filters
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| navn | No | Sub-entity name (1-180 characters) | |
| navnMetodeForSoek | No | Search method for name parameter | |
| organisasjonsnummer | No | List of organization numbers (9 digits) | |
| overordnetEnhet | No | Parent entity organization number | |
| fraAntallAnsatte | No | Minimum number of employees | |
| tilAntallAnsatte | No | Maximum number of employees | |
| registrertIMvaregisteret | No | Registered in VAT registry | |
| fraOppstartsdato | No | Start date from (ISO-8601 yyyy-MM-dd) | |
| tilOppstartsdato | No | Start date to (ISO-8601 yyyy-MM-dd) | |
| fraDatoEierskifte | No | Ownership change date from (ISO-8601 yyyy-MM-dd) | |
| tilDatoEierskifte | No | Ownership change date to (ISO-8601 yyyy-MM-dd) | |
| fraNedleggelsesdato | No | Closure date from (ISO-8601 yyyy-MM-dd) | |
| tilNedleggelsesdato | No | Closure date to (ISO-8601 yyyy-MM-dd) | |
| organisasjonsform | No | Organizational forms | |
| hjemmeside | No | Website | |
| kommunenummer | No | Municipality numbers | |
| naeringskode | No | Industry codes | |
| size | No | Page size (default 20) | |
| page | No | Page number | |
| sort | No | Sort field and order |
Implementation Reference
- src/brreg-mcp-server.ts:91-93 (handler)Core handler function in BrregApiClient that executes the tool logic by making an API request to the BRREG underenheter endpoint using the shared makeRequest method.async searchSubEntities(params: SubEntitySearchParams = {}) { return this.makeRequest('/enhetsregisteret/api/underenheter', params); }
- src/brreg-mcp-server.ts:38-45 (schema)TypeScript interface defining the input parameters for the search_sub_entities tool, extending EntitySearchParams and adding specific date filters for sub-entities.interface SubEntitySearchParams extends Omit<EntitySearchParams, 'konkurs' | 'underTvangsavviklingEllerTvangsopplosning' | 'underAvvikling' | 'underKonkursbehandling'> { fraOppstartsdato?: string; tilOppstartsdato?: string; fraDatoEierskifte?: string; tilDatoEierskifte?: string; fraNedleggelsesdato?: string; tilNedleggelsesdato?: string; }
- src/brreg-mcp-server.ts:233-260 (registration)Registration of the search_sub_entities tool in the ListToolsRequest handler, including name, description, and detailed inputSchema.name: "search_sub_entities", description: "Search for Norwegian business sub-entities (underenheter) with various filters", inputSchema: { type: "object", properties: { navn: { type: "string", description: "Sub-entity name (1-180 characters)" }, navnMetodeForSoek: { type: "string", enum: ["FORTLOEPENDE"], description: "Search method for name parameter" }, organisasjonsnummer: { type: "array", items: { type: "string" }, description: "List of organization numbers (9 digits)" }, overordnetEnhet: { type: "string", description: "Parent entity organization number" }, fraAntallAnsatte: { type: "number", description: "Minimum number of employees" }, tilAntallAnsatte: { type: "number", description: "Maximum number of employees" }, registrertIMvaregisteret: { type: "boolean", description: "Registered in VAT registry" }, fraOppstartsdato: { type: "string", description: "Start date from (ISO-8601 yyyy-MM-dd)" }, tilOppstartsdato: { type: "string", description: "Start date to (ISO-8601 yyyy-MM-dd)" }, fraDatoEierskifte: { type: "string", description: "Ownership change date from (ISO-8601 yyyy-MM-dd)" }, tilDatoEierskifte: { type: "string", description: "Ownership change date to (ISO-8601 yyyy-MM-dd)" }, fraNedleggelsesdato: { type: "string", description: "Closure date from (ISO-8601 yyyy-MM-dd)" }, tilNedleggelsesdato: { type: "string", description: "Closure date to (ISO-8601 yyyy-MM-dd)" }, organisasjonsform: { type: "array", items: { type: "string" }, description: "Organizational forms" }, hjemmeside: { type: "string", description: "Website" }, kommunenummer: { type: "array", items: { type: "string" }, description: "Municipality numbers" }, naeringskode: { type: "array", items: { type: "string" }, description: "Industry codes" }, size: { type: "number", description: "Page size (default 20)" }, page: { type: "number", description: "Page number" }, sort: { type: "string", description: "Sort field and order" } } } },
- src/brreg-mcp-server.ts:437-446 (handler)MCP tool dispatcher case in CallToolRequestSchema handler that calls the searchSubEntities method and returns the JSON-formatted results.case "search_sub_entities": const subEntityResults = await apiClient.searchSubEntities(request.params.arguments as SubEntitySearchParams); return { content: [ { type: "text", text: JSON.stringify(subEntityResults, null, 2), }, ], };
- src/brreg-mcp-server.ts:48-77 (helper)Shared helper method used by searchSubEntities (and other tools) to construct and execute HTTP requests to the 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(); }