Skip to main content
Glama
ertiqah
by ertiqah

analyze_linkedin_chat

Ask questions and analyze your LinkedIn profile, content, or network through multi-turn conversations.

Instructions

Ask questions about the user's LinkedIn profile, content, or network, with support for multi-turn conversations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe question or request about LinkedIn data to be analyzed.
conversation_historyNoOptional. Previous messages in the conversation for context. Each message must have 'role' (user/assistant) and 'content' (text).

Implementation Reference

  • cli.js:443-530 (handler)
    The main handler for the analyze_linkedin_chat tool. It receives the MCP call, validates the API key, 'query' (required string) and 'conversation_history' (optional array) arguments, calls the backend API at backendAnalyzeChatApiUrl, and returns the AI-generated reply text to the user.
    } else if (name === 'analyze_linkedin_chat') {
        console.error(`${packageName}: Received call for analyze_linkedin_chat tool.`);
        const apiKey = process.env.LINKEDIN_MCP_API_KEY;
        const query = args?.query;
        const conversationHistory = args?.conversation_history || [];
    
        if (!apiKey) {
            sendResponse({ jsonrpc: "2.0", error: { code: -32001, message: "Server Configuration Error: API Key not set." }, id });
            return;
        }
        if (typeof query !== 'string' || query.trim() === '') {
            sendResponse({ jsonrpc: "2.0", error: { code: -32602, message: "Invalid arguments: 'query' (string) required." }, id });
            return;
        }
        if (!Array.isArray(conversationHistory)) {
            sendResponse({ jsonrpc: "2.0", error: { code: -32602, message: "Invalid arguments: 'conversation_history' must be an array." }, id });
            return;
        }
    
        try {
            const headers = { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json", "Accept": "application/json" };
            const payload = { 
              "query": query,
              "conversation_history": conversationHistory
            };
            console.error(`${packageName}: Calling analyze chat API: ${backendAnalyzeChatApiUrl} with payload:`, JSON.stringify(payload, null, 2));
            const apiResponse = await axios.post(backendAnalyzeChatApiUrl, payload, { headers, timeout: 60000 });
            console.error(`${packageName}: Analyze chat API response status: ${apiResponse.status}`);
            console.error(`${packageName}: Analyze chat API response data:`, JSON.stringify(apiResponse.data, null, 2));
    
            if (apiResponse.data && apiResponse.data.reply) {
                sendResponse({ 
                  jsonrpc: "2.0", 
                  result: { 
                    content: [
                      {
                        type: "text",
                        text: apiResponse.data.reply
                      }
                    ],
                    isError: false
                  }, 
                  id 
                });
            } else {
                const errorMessage = apiResponse.data?.error || "Backend API Error (no detail)";
                console.error(`${packageName}: Analyze chat API Error: ${errorMessage}`);
                sendResponse({ 
                  jsonrpc: "2.0", 
                  result: {
                    content: [
                      {
                        type: "text",
                        text: `Failed to analyze LinkedIn chat: ${errorMessage}`
                      }
                    ],
                    isError: true
                  }, 
                  id 
                });
            }
    
        } catch (error) {
            let errorMessage = `Failed to call analyze chat API: ${error.message}`;
            if (error.response) {
                // Extract the error message directly from the backend response
                const backendError = error.response.data?.error || error.response.data?.message;
                errorMessage = backendError || `Backend API Error (Status ${error.response.status})`;
                console.error(`${packageName}: Analyze chat API Error Response:`, error.response.data); 
            } else if (error.request) {
                errorMessage = "No response received from analyze chat API.";
            }
            console.error(`${packageName}: ${errorMessage}`);
            
            sendResponse({ 
              jsonrpc: "2.0", 
              result: { 
                content: [
                  {
                    type: "text",
                    text: `Failed to analyze LinkedIn chat: ${errorMessage}`
                  }
                ],
                isError: true
              }, 
              id 
            });
        }
  • The input schema registered for analyze_linkedin_chat. Defines 'query' (required string) and 'conversation_history' (optional array of {role, content} objects) properties.
    {
        name: "analyze_linkedin_chat",
        description: "Ask questions about the user's LinkedIn profile, content, or network, with support for multi-turn conversations.",
        inputSchema: {
            type: "object",
            properties: {
                query: {
                    type: "string",
                    description: "The question or request about LinkedIn data to be analyzed."
                },
                conversation_history: {
                    type: "array",
                    description: "Optional. Previous messages in the conversation for context. Each message must have 'role' (user/assistant) and 'content' (text).",
                    items: {
                        type: "object",
                        properties: {
                            role: {
                                type: "string",
                                description: "The sender of the message: 'user' or 'assistant'."
                            },
                            content: {
                                type: "string",
                                description: "The text content of the message."
                            }
                        },
                        required: ["role", "content"]
                    }
                }
            },
            required: ["query"]
        }
  • cli.js:1289-1320 (registration)
    The registration of the analyze_linkedin_chat tool in the tools/list response, declaring its name, description, and inputSchema to the MCP client.
    {
        name: "analyze_linkedin_chat",
        description: "Ask questions about the user's LinkedIn profile, content, or network, with support for multi-turn conversations.",
        inputSchema: {
            type: "object",
            properties: {
                query: {
                    type: "string",
                    description: "The question or request about LinkedIn data to be analyzed."
                },
                conversation_history: {
                    type: "array",
                    description: "Optional. Previous messages in the conversation for context. Each message must have 'role' (user/assistant) and 'content' (text).",
                    items: {
                        type: "object",
                        properties: {
                            role: {
                                type: "string",
                                description: "The sender of the message: 'user' or 'assistant'."
                            },
                            content: {
                                type: "string",
                                description: "The text content of the message."
                            }
                        },
                        required: ["role", "content"]
                    }
                }
            },
            required: ["query"]
        }
    },
  • cli.js:14-15 (helper)
    The backend API URL constant for analyze-linkedin-chat, pointing to 'https://ligosocial.com/api/mcp/analyze-linkedin-chat'.
    const backendAnalyzeChatApiUrl = 'https://ligosocial.com/api/mcp/analyze-linkedin-chat';
    const backendGeneratePostApiUrl = 'https://ligosocial.com/api/mcp/generate-linkedin-post';
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only mentions multi-turn conversation support but omits critical traits such as whether the tool is read-only, authentication requirements, or any side effects. Given the lack of annotations, this is insufficient.

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, front-loaded sentence that conveys the core functionality and key feature (multi-turn) efficiently. No extraneous information.

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?

The description explains what the tool does but does not specify the output format or return value, which is notable given the absence of an output schema. For a conversational Q&A tool, stating that it returns answers or analysis would improve completeness. The multi-turn support is a plus, but the overall context lacks details on behavior and results.

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

Parameters3/5

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

The input schema has 100% coverage, with both parameters clearly described. The description adds the context of 'multi-turn conversations', which implicitly explains the conversation_history parameter, but does not provide additional meaning beyond the schema. Baseline of 3 is appropriate.

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 tool's purpose: 'Ask questions about the user's LinkedIn profile, content, or network' with multi-turn support. It distinguishes itself from sibling tools like get_linkedin_profile and get_linkedin_posts by focusing on analysis and conversation rather than retrieval or publishing.

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

Usage Guidelines3/5

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

The description implies usage for analytical questions about LinkedIn data, but it does not provide explicit guidance on when to use this tool versus alternatives (e.g., get_linkedin_profile for raw data). No exclusion criteria or alternative references are given.

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