set_linkedin_url
Set the LinkedIn profile URL for analysis. Required before using profile or posts retrieval tools if not set previously.
Instructions
Set or update the LinkedIn profile URL to analyze. Required before using profile/posts retrieval tools if not set previously.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| linkedin_url | Yes | The full LinkedIn profile URL (e.g., https://www.linkedin.com/in/username/) |
Implementation Reference
- cli.js:1360-1373 (registration)Tool registration for set_linkedin_url in the tools/list response, defining name, description, and inputSchema with required linkedin_url parameter.
{ name: "set_linkedin_url", description: "Set or update the LinkedIn profile URL to analyze. Required before using profile/posts retrieval tools if not set previously.", inputSchema: { type: "object", properties: { linkedin_url: { type: "string", description: "The full LinkedIn profile URL (e.g., https://www.linkedin.com/in/username/)" } }, required: ["linkedin_url"] } }, - cli.js:931-1021 (handler)Handler implementation for set_linkedin_url. Validates API key and linkedin_url argument, then calls backend API at backendLinkedinSetUrlApiUrl (https://ligosocial.com/api/mcp/linkedin/set-url) with the provided URL. Returns success message or error.
} else if (name === 'set_linkedin_url') { console.error(`${packageName}: Received call for set_linkedin_url tool.`); const apiKey = process.env.LINKEDIN_MCP_API_KEY; const linkedinUrl = args?.linkedin_url; if (!apiKey) { sendResponse({ jsonrpc: "2.0", error: { code: -32001, message: "Server Configuration Error: API Key not set." }, id }); return; } if (typeof linkedinUrl !== 'string' || linkedinUrl.trim() === '') { sendResponse({ jsonrpc: "2.0", error: { code: -32602, message: "Invalid arguments: 'linkedin_url' (string) required." }, id }); return; } try { const headers = { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json", "Accept": "application/json" }; const payload = { linkedin_url: linkedinUrl }; console.error(`${packageName}: Calling set LinkedIn URL API: ${backendLinkedinSetUrlApiUrl} with payload:`, JSON.stringify(payload, null, 2)); const apiResponse = await axios.post(backendLinkedinSetUrlApiUrl, payload, { headers, timeout: 60000 }); console.error(`${packageName}: Set LinkedIn URL API response status: ${apiResponse.status}`); console.error(`${packageName}: Set LinkedIn URL API response data:`, JSON.stringify(apiResponse.data, null, 2)); if (apiResponse.data && apiResponse.data.success) { sendResponse({ jsonrpc: "2.0", result: { content: [ { type: "text", text: apiResponse.data.message || "Successfully set LinkedIn URL." } ], isError: false }, id }); } else { const errorMessage = apiResponse.data?.error || "Backend API Error (no detail)"; console.error(`${packageName}: Set LinkedIn URL API Error: ${errorMessage}`); sendResponse({ jsonrpc: "2.0", result: { content: [ { type: "text", text: `Failed to set LinkedIn URL: ${errorMessage}. Please ensure the URL is a valid LinkedIn profile URL (e.g., https://www.linkedin.com/in/username/).` } ], isError: true }, id }); } } catch (error) { let errorMessage = `Failed to call set LinkedIn URL API: ${error.message}`; if (error.response) { // Extract complete error details from the response const responseData = error.response.data || {}; const extractedError = responseData.error || responseData.message || (typeof responseData === 'string' ? responseData : null); // Use the backend's full error message if (extractedError) { errorMessage = extractedError; } else { // Fallback with a generic message but including the status errorMessage = `Backend API Error (Status ${error.response.status}): Unknown error`; } console.error(`${packageName}: Set LinkedIn URL API Error Response:`, error.response.data); } else if (error.request) { errorMessage = "No response received from set LinkedIn URL API. The server may be unavailable or experiencing issues."; } console.error(`${packageName}: ${errorMessage}`); sendResponse({ jsonrpc: "2.0", result: { content: [ { type: "text", text: `Failed to set LinkedIn URL: ${errorMessage}` } ], isError: true }, id }); } - cli.js:1363-1372 (schema)Input schema for set_linkedin_url: requires a single 'linkedin_url' string property (the full LinkedIn profile URL, e.g., https://www.linkedin.com/in/username/).
inputSchema: { type: "object", properties: { linkedin_url: { type: "string", description: "The full LinkedIn profile URL (e.g., https://www.linkedin.com/in/username/)" } }, required: ["linkedin_url"] } - cli.js:18-18 (helper)Backend API URL constant: backendLinkedinSetUrlApiUrl pointing to https://ligosocial.com/api/mcp/linkedin/set-url used by the set_linkedin_url handler.
const backendLinkedinSetUrlApiUrl = 'https://ligosocial.com/api/mcp/linkedin/set-url';