search_companies
Search the Swiss company registry (ZEFIX) by name, canton, or legal form to find business information. This tool helps identify companies using specific criteria without requiring API keys.
Instructions
Search Swiss company registry (ZEFIX) by name, canton, or legal form
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Company name or partial name to search | |
| canton | No | Canton abbreviation (e.g. ZH, BE, GE, ZG) | |
| legal_form | No | Legal form code (e.g. 0106=GmbH, 0101=AG) | |
| limit | No | Max results (default: 20) |
Implementation Reference
- src/modules/companies.ts:63-84 (handler)The handler implementation for the 'search_companies' tool, which constructs and sends a POST request to the ZEFIX search endpoint.
case "search_companies": { const body: Record<string, unknown> = { name: args.name as string, maxEntries: (args.limit as number) ?? 20, languageKey: "en", }; if (args.canton) body.cantonAbbreviation = [args.canton as string]; if (args.legal_form) body.legalFormCode = args.legal_form as string; const response = await fetch(`${BASE}/firm/search.json`, { method: "POST", headers: { "Content-Type": "application/json", "Accept": "application/json" }, body: JSON.stringify(body), }); if (response.status === 404) { return JSON.stringify({ companies: [], hasMoreResults: false }, null, 2); } if (!response.ok) throw new Error(`HTTP ${response.status}: ${response.statusText}`); const data = await response.json() as { list?: unknown[]; hasMoreResults?: boolean; error?: unknown }; if (data.error) return JSON.stringify({ companies: [], hasMoreResults: false }, null, 2); return JSON.stringify({ companies: data.list ?? [], hasMoreResults: data.hasMoreResults ?? false }, null, 2); } - src/modules/companies.ts:6-19 (schema)The input schema definition for 'search_companies', including name, canton, legal_form, and limit parameters.
{ name: "search_companies", description: "Search Swiss company registry (ZEFIX) by name, canton, or legal form", inputSchema: { type: "object", required: ["name"], properties: { name: { type: "string", description: "Company name or partial name to search" }, canton: { type: "string", description: "Canton abbreviation (e.g. ZH, BE, GE, ZG)" }, legal_form: { type: "string", description: "Legal form code (e.g. 0106=GmbH, 0101=AG)" }, limit: { type: "number", description: "Max results (default: 20)" }, }, }, },