profiles
Retrieve and enrich professional profiles using a LinkedIn URL or a person's name and company.
Instructions
Find and enrich a professional profile by LinkedIn URL or name + company. Cost: 3 credits.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| linkedin_url | No | LinkedIn profile URL (fastest path) | |
| first_name | No | Person's first name | |
| last_name | No | Person's last name | |
| company | No | Company name to narrow search |
Implementation Reference
- src/index.ts:55-63 (schema)Schema definition for the 'profiles' tool: defines the capability name, description, and input schema (linkedin_url, first_name, last_name, company).
{ name: "profiles", description: "Find and enrich a professional profile by LinkedIn URL or name + company. Cost: 3 credits.", inputSchema: { linkedin_url: z.string().optional().describe("LinkedIn profile URL (fastest path)"), first_name: z.string().optional().describe("Person's first name"), last_name: z.string().optional().describe("Person's last name"), company: z.string().optional().describe("Company name to narrow search"), }, - src/index.ts:246-258 (registration)Registration loop that registers all capabilities (including 'profiles') as MCP tools on the server using server.registerTool(). The handler delegates to callSuprsonic(cap.name, args).
// Register each capability as an MCP tool for (const cap of CAPABILITIES) { // Cast inputSchema to avoid TS2589 (excessively deep type instantiation from Zod chains) server.registerTool( cap.name, { description: cap.description, inputSchema: cap.inputSchema as any, }, async (args: any): Promise<CallToolResult> => { return callSuprsonic(cap.name, args as Record<string, unknown>); }, ); - src/index.ts:183-234 (handler)The generic HTTP handler (callSuprsonic) that executes all tool logic including 'profiles'. It sends the capability name and params to the Suprsonic REST API at POST /v1/agent.
async function callSuprsonic(capability: string, params: Record<string, unknown>): Promise<CallToolResult> { if (!API_KEY) { return { content: [{ type: "text", text: "Error: SUPRSONIC_API_KEY environment variable is not set. Get your key at https://suprsonic.ai/app/apis" }], isError: true, }; } try { const resp = await fetch(`${BASE_URL}/v1/agent`, { method: "POST", headers: { "Authorization": `Bearer ${API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ capability, params }), }); const result = await resp.json() as any; // Handle non-envelope responses (401, 429, etc. return {"detail": ...}) if (result.detail && result.success === undefined) { const msg = typeof result.detail === "object" ? (result.detail.title || result.detail.detail || JSON.stringify(result.detail)) : String(result.detail); return { content: [{ type: "text", text: `Error (HTTP ${resp.status}): ${msg}` }], isError: true, }; } if (!result.success) { const errMsg = result.error?.detail || result.error?.title || "Request failed"; return { content: [{ type: "text", text: `Error: ${errMsg}` }], isError: true, }; } const text = JSON.stringify(result.data, null, 2); const meta = result.metadata ? `\n\n[Provider: ${(result.metadata as any).provider_used || "unknown"}, ${(result.metadata as any).response_time_ms || 0}ms, ${result.credits_used || 0} credits]` : ""; return { content: [{ type: "text", text: text + meta }], }; } catch (err) { return { content: [{ type: "text", text: `Network error: ${err instanceof Error ? err.message : String(err)}` }], isError: true, }; } }