Get company directors
get_directorsRetrieve current and past directors for UK companies, including appointment dates, roles, and their corporate history across multiple organizations.
Instructions
Get the current and past directors for a UK company, including each director's name, role, appointment date, resignation date (if applicable), nationality, country of residence, and a list of other companies they serve or have served as director. This gives you a full picture of a director's corporate history in one call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| company_number | Yes | Companies House company number, e.g. '00445790' for Tesco PLC |
Implementation Reference
- src/server.ts:164-171 (handler)The handler function for get_directors tool - an async function that takes company_number, calls the API endpoint /company/{company_number}/directors, and returns the formatted response or error.
async ({ company_number }) => { try { const data = await api(`/company/${company_number}/directors`); return text(data); } catch (e) { return err(String(e)); } } - src/server.ts:157-162 (schema)Input schema for get_directors tool using Zod - validates company_number as a string matching regex pattern /^[A-Z0-9]{1,8}$/ (Companies House company number format).
inputSchema: { company_number: z .string() .regex(/^[A-Z0-9]{1,8}$/) .describe("Companies House company number, e.g. '00445790' for Tesco PLC"), }, - src/server.ts:148-172 (registration)Tool registration for get_directors using server.registerTool() - includes title, description, inputSchema, and the handler function.
server.registerTool( "get_directors", { title: "Get company directors", description: "Get the current and past directors for a UK company, including each director's " + "name, role, appointment date, resignation date (if applicable), nationality, " + "country of residence, and a list of other companies they serve or have served as " + "director. This gives you a full picture of a director's corporate history in one call.", inputSchema: { company_number: z .string() .regex(/^[A-Z0-9]{1,8}$/) .describe("Companies House company number, e.g. '00445790' for Tesco PLC"), }, }, async ({ company_number }) => { try { const data = await api(`/company/${company_number}/directors`); return text(data); } catch (e) { return err(String(e)); } } ); - src/server.ts:7-25 (helper)callApi helper function that performs the actual HTTP fetch to the Registrum API with API key authentication - used by get_directors handler via the 'api' wrapper.
export async function callApi( path: string, apiKey: string, baseUrl: string = API_BASE ): Promise<unknown> { if (!apiKey) { throw new Error( "REGISTRUM_API_KEY is not set. Get a free key at https://registrum.co.uk and set it in your MCP client config." ); } const res = await fetch(`${baseUrl}${path}`, { headers: { "X-API-Key": apiKey }, }); if (!res.ok) { const body = await res.text(); throw new Error(`API error ${res.status}: ${body}`); } return res.json(); } - src/server.ts:27-38 (helper)Helper functions 'text' and 'err' that format successful and error responses respectively for MCP tool outputs - used by get_directors handler to return results.
function text(content: unknown) { return { content: [{ type: "text" as const, text: JSON.stringify(content, null, 2) }], }; } function err(message: string) { return { isError: true as const, content: [{ type: "text" as const, text: message }], }; }