Skip to main content
Glama
ertiqah
by ertiqah

get_linkedin_profile

Retrieve LinkedIn profile information including headline, summary, experience, and education.

Instructions

Retrieve the user's LinkedIn profile information including headline, summary, experience, and education.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • cli.js:796-930 (handler)
    Handler for the get_linkedin_profile tool. Validates API key, calls the backend LinkedIn profile API, formats the profile data (headline, summary, experience, education) into readable text, and returns it.
    } else if (name === 'get_linkedin_profile') {
        console.error(`${packageName}: Received call for get_linkedin_profile tool.`);
        const apiKey = process.env.LINKEDIN_MCP_API_KEY;
    
        if (!apiKey) {
            sendResponse({ jsonrpc: "2.0", error: { code: -32001, message: "Server Configuration Error: API Key not set." }, id });
            return;
        }
    
        try {
            const headers = { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json", "Accept": "application/json" };
            console.error(`${packageName}: Calling LinkedIn profile API: ${backendLinkedinProfileApiUrl}`);
            const apiResponse = await axios.post(backendLinkedinProfileApiUrl, {}, { headers, timeout: 60000 });
            console.error(`${packageName}: LinkedIn profile API response status: ${apiResponse.status}`);
            console.error(`${packageName}: LinkedIn profile API response data:`, JSON.stringify(apiResponse.data, null, 2));
    
            if (apiResponse.data && apiResponse.data.success) {
                const profile = apiResponse.data.profile || {};
                
                // Format profile as text to avoid "unsupported content type: data" error
                let profileHeadline = profile.headline || 'No headline';
                let profileSummary = profile.summary || 'No summary';
                
                // Format experience entries
                let experienceText = 'Experience:';
                if (profile.experience && Array.isArray(profile.experience) && profile.experience.length > 0) {
                    profile.experience.forEach((exp, index) => {
                        experienceText += `\n\n${index + 1}. ${exp.title || 'Role'} at ${exp.companyName || 'Company'}`;
                        if (exp.dateRange || exp.duration) {
                            experienceText += `\n   Duration: ${exp.dateRange || exp.duration || 'Not specified'}`;
                        }
                        if (exp.description) {
                            experienceText += `\n   Description: ${exp.description}`;
                        }
                    });
                } else {
                    experienceText += '\n   No experience data available';
                }
                
                // Format education entries
                let educationText = '\n\nEducation:';
                if (profile.education && Array.isArray(profile.education) && profile.education.length > 0) {
                    profile.education.forEach((edu, index) => {
                        educationText += `\n\n${index + 1}. ${edu.schoolName || edu.school || 'Institution'}`;
                        if (edu.degree || edu.fieldOfStudy) {
                            educationText += `\n   ${edu.degree || ''} ${edu.fieldOfStudy || ''}`.trim();
                        }
                        if (edu.dateRange || edu.dates) {
                            educationText += `\n   Years: ${edu.dateRange || edu.dates || 'Not specified'}`;
                        }
                    });
                } else {
                    educationText += '\n   No education data available';
                }
                
                // Combine all text
                const profileText = `Headline: ${profileHeadline}\n\nSummary: ${profileSummary}\n\n${experienceText}${educationText}`;
                
                sendResponse({ 
                  jsonrpc: "2.0", 
                  result: { 
                    content: [
                      {
                        type: "text",
                        text: `LinkedIn profile data retrieved. Last updated: ${apiResponse.data.data_last_updated || 'Unknown'}`
                      },
                      {
                        type: "text",
                        text: profileText
                      }
                    ],
                    isError: false
                  }, 
                  id 
                });
            } else {
                const errorMessage = apiResponse.data?.error || "Backend API Error (no detail)";
                console.error(`${packageName}: LinkedIn profile API Error: ${errorMessage}`);
                sendResponse({ 
                  jsonrpc: "2.0", 
                  result: {
                    content: [
                      {
                        type: "text",
                        text: `Failed to get LinkedIn profile: ${errorMessage}. This may occur if you haven't set your LinkedIn URL yet. Try using the set_linkedin_url tool first.`
                      }
                    ],
                    isError: true
                  }, 
                  id 
                });
            }
    
        } catch (error) {
            let errorMessage = `Failed to call LinkedIn profile 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);
                
                // Include any suggestion provided
                const suggestion = responseData.suggestion
                    ? `\n\nSuggestion: ${responseData.suggestion}`
                    : '';
                
                // Use the backend's full error message
                if (extractedError) {
                    errorMessage = `${extractedError}${suggestion}`;
                } else {
                    // Fallback with a generic message but including the status
                    errorMessage = `Backend API Error (Status ${error.response.status}): Unknown error${suggestion}`;
                }
                
                console.error(`${packageName}: LinkedIn profile API Error Response:`, error.response.data); 
            } else if (error.request) {
                errorMessage = "No response received from LinkedIn profile API. The server may be unavailable or experiencing issues.";
            }
            console.error(`${packageName}: ${errorMessage}`);
            
            sendResponse({ 
              jsonrpc: "2.0", 
              result: { 
                content: [
                  {
                    type: "text",
                    text: `Failed to get LinkedIn profile: ${errorMessage}`
                  }
                ],
                isError: true
              }, 
              id 
            });
        }
  • cli.js:1352-1359 (registration)
    Registration of the get_linkedin_profile tool in the tools/list response, defining its name, description, and empty input schema.
    {
        name: "get_linkedin_profile",
        description: "Retrieve the user's LinkedIn profile information including headline, summary, experience, and education.",
        inputSchema: {
            type: "object",
            properties: {}
        }
    },
  • cli.js:17-20 (helper)
    Backend API endpoint URL constant used by the get_linkedin_profile handler to make the actual HTTP request.
    const backendLinkedinProfileApiUrl = 'https://ligosocial.com/api/mcp/linkedin/profile';
    const backendLinkedinSetUrlApiUrl = 'https://ligosocial.com/api/mcp/linkedin/set-url';
    const backendLinkedinRefreshProfileApiUrl = 'https://ligosocial.com/api/mcp/linkedin/refresh-profile';
    const backendLinkedinRefreshPostsApiUrl = 'https://ligosocial.com/api/mcp/linkedin/refresh-posts';
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It correctly implies a read-only operation ('retrieve') but does not disclose any specific behavioral traits, rate limits, or authentication requirements. The description is adequate but not enhanced.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence that immediately conveys the tool's purpose. Every word adds value, with no redundancy or filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple retrieval tool with no parameters and no output schema, the description lists included fields but fails to clarify which profile is retrieved (e.g., current user's profile vs. a previously set URL). Given sibling 'set_linkedin_url', additional context would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has no parameters, and schema coverage is 100%. According to rules, 0 parameters gives a baseline of 4. The description does not need to add parameter information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'retrieve' and the resource 'LinkedIn profile information', listing specific fields like headline, summary, experience, and education. It effectively distinguishes from siblings like 'get_linkedin_posts' and 'refresh_linkedin_profile'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as 'refresh_linkedin_profile' or any prerequisites. The description lacks context about the intended use case or conditions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ertiqah/linkedin-mcp-runner'

If you have feedback or need assistance with the MCP directory API, please join our Discord server