search_companies
Find companies by name in the OpenCorporates database. Returns name, number, jurisdiction, status, incorporation date, and address.
Instructions
Search companies by name in the OpenCorporates database. Returns matching companies with name, number, jurisdiction, status, incorporation date, and registered address.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | Company name or search query | |
| jurisdiction_code | No | Jurisdiction code to filter results (e.g. 'us_de' for Delaware, 'gb' for UK, 'de' for Germany) | |
| page | No | Page number for pagination (default 1) |
Implementation Reference
- src/index.ts:197-220 (handler)The handler that executes the search_companies tool logic. It extracts 'q', 'jurisdiction_code', and 'page' from args, calls the OpenCorporates API at /companies/search, maps the results to a clean JSON output, and returns it as text.
case "search_companies": { const { q, jurisdiction_code, page } = args as unknown as SearchCompaniesArgs; if (!q) throw new Error("Parameter 'q' is required"); const data = (await apiFetch("/companies/search", { q, jurisdiction_code, page, })) as { results: { companies: Array<{ company: Record<string, unknown> }> } }; const companies = data.results?.companies ?? []; if (companies.length === 0) return textResult("No companies found matching that query."); const out = companies.map(({ company: c }) => ({ name: c["name"], company_number: c["company_number"], jurisdiction_code: c["jurisdiction_code"], status: c["current_status"], incorporation_date: c["incorporation_date"], registered_address: formatAddress(c["registered_address"]), opencorporates_url: c["opencorporates_url"], })); return textResult(JSON.stringify(out, null, 2)); } - src/index.ts:96-112 (registration)Registration of the 'search_companies' tool in the ListTools handler, including its name, description, and JSON input schema.
name: "search_companies", description: "Search companies by name in the OpenCorporates database. Returns matching companies with name, number, jurisdiction, status, incorporation date, and registered address.", inputSchema: { type: "object", properties: { q: { type: "string", description: "Company name or search query" }, jurisdiction_code: { type: "string", description: "Jurisdiction code to filter results (e.g. 'us_de' for Delaware, 'gb' for UK, 'de' for Germany)", }, page: { type: "number", description: "Page number for pagination (default 1)" }, }, required: ["q"], }, }, - src/index.ts:63-67 (schema)TypeScript interface SearchCompaniesArgs defining the input shape: 'q' (required string), 'jurisdiction_code' (optional string), 'page' (optional number).
interface SearchCompaniesArgs { q: string; jurisdiction_code?: string; page?: number; }