company_lookup
Look up Indian company profiles and regulatory information from MCA21 and GST portal databases to verify business details and compliance status.
Instructions
Lookup Indian company profile and regulatory info from MCA21, GST portal. Cost: $0.003 USDC. Service: papertrail.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| company_name | Yes | ||
| cin | No | ||
| gstin | No |
Implementation Reference
- src/index.ts:166-223 (handler)The `CallToolRequestSchema` handler dynamically resolves tools (including 'company_lookup' if present in the registry) by name and delegates execution to `callTool`.
server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; let registry: Registry; try { registry = await fetchRegistry(); } catch (error) { return { content: [ { type: "text", text: JSON.stringify({ error: "Failed to fetch tool registry", detail: String(error) }), }, ], }; } const tool = registry.tools.find((t) => t.name === name); if (!tool) { return { content: [ { type: "text", text: JSON.stringify({ error: `Tool '${name}' not found`, available_tools: registry.tools.map((t) => t.name), }), }, ], }; } try { const result = await callTool(tool, args as Record<string, unknown>); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify({ error: "Tool call failed", tool: name, service: tool.service, detail: String(error), }), }, ], }; } }); - src/index.ts:88-132 (handler)The generic `callTool` function that performs the actual network request for tools fetched from the registry.
async function callTool( tool: RegistryTool, args: Record<string, unknown> ): Promise<unknown> { const headers: Record<string, string> = { "Content-Type": "application/json", }; if (X_PAYMENT_HEADER) { headers["X-PAYMENT"] = X_PAYMENT_HEADER; } if (DEV_MODE) { headers["X-Dev-Mode"] = "true"; } const response = await fetch(tool.endpoint, { method: tool.method, headers, body: JSON.stringify(args), }); if (response.status === 402) { const detail = await response.json().catch(() => ({})); return { error: "Payment Required", amount_usdc: tool.cost_usdc, service: tool.service, instructions: "Set X_PAYMENT_HEADER env var with a valid x402 payment proof, or set DEV_MODE=true for testing.", detail, }; } if (!response.ok) { const text = await response.text().catch(() => "Unknown error"); return { error: `HTTP ${response.status}`, service: tool.service, detail: text, }; } return await response.json(); }