no_company_roles
Retrieve board members, CEO, auditor, and other roles for Norwegian companies using their 9-digit organization number.
Instructions
Get roles (board members, CEO, auditor, etc.) for a Norwegian company
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| org_number | Yes | 9-digit organization number |
Implementation Reference
- The implementation and registration of the 'no_company_roles' tool, which fetches roles from the Norwegian Brønnøysund Register Centre API.
server.tool( "no_company_roles", "Get roles (board members, CEO, auditor, etc.) for a Norwegian company", { org_number: z.string().describe("9-digit organization number"), }, async ({ org_number }) => { const clean = org_number.replace(/\s/g, ""); const res = await fetch(`https://data.brreg.no/enhetsregisteret/api/enheter/${clean}/roller`, { headers: { Accept: "application/json", "User-Agent": USER_AGENT }, }); if (!res.ok) { if (res.status === 404) { return { content: [{ type: "text", text: `No roles found for org number ${clean}.` }] }; } throw new Error(`API error (${res.status})`); } const data = await res.json(); const groups = data.rollegrupper || []; if (groups.length === 0) { return { content: [{ type: "text", text: "No role information available for this company." }] }; } const lines = [`**Roles for ${clean}:**\n`]; for (const group of groups) { lines.push(`## ${group.type?.beskrivelse || "Unknown"}`); for (const role of group.roller || []) { const person = role.person; const org = role.enhet; if (person) { const name = [person.fornavn, person.mellomnavn, person.etternavn].filter(Boolean).join(" "); lines.push(`- ${name} (${role.type?.beskrivelse || "?"})${role.fratraadt ? " [resigned]" : ""}`); } else if (org) { lines.push(`- ${org.organisasjonsnummer} ${org.organisasjonsform?.kode || ""} (${role.type?.beskrivelse || "?"})`); } } lines.push(""); } return { content: [{ type: "text", text: lines.join("\n") }] }; } );