fi_company_lookup
Retrieve detailed Finnish company information using a Business ID (Y-tunnus), including registers, addresses, and historical data.
Instructions
Look up a Finnish company by Business ID (Y-tunnus). Returns detailed information including registers, addresses, and history.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| business_id | Yes | Finnish Business ID (Y-tunnus), e.g., '0112038-9' or '2331972-6' |
Implementation Reference
- src/servers/finnish-companies.js:210-232 (handler)The implementation of the 'fi_company_lookup' tool, which handles the validation of the Business ID and fetches company details from the PRH API.
server.tool( "fi_company_lookup", "Look up a Finnish company by Business ID (Y-tunnus). Returns detailed information including registers, addresses, and history.", { business_id: z.string().describe("Finnish Business ID (Y-tunnus), e.g., '0112038-9' or '2331972-6'"), }, async ({ business_id }) => { const clean = business_id.trim(); // Finnish business IDs are format: 7 digits, dash, 1 check digit if (!/^\d{7}-\d$/.test(clean)) { return { content: [{ type: "text", text: "Invalid Business ID format. Expected format: 1234567-8 (7 digits, dash, check digit)." }] }; } const data = await apiFetch("/companies", { businessId: clean }); const companies = data.companies || []; if (companies.length === 0) { return { content: [{ type: "text", text: `No company found with Business ID ${clean}.` }] }; } return { content: [{ type: "text", text: formatCompanyDetail(companies[0]) }] }; } );