Skip to main content
Glama

get_linkedin_chat_messages

Retrieve LinkedIn chat messages for a specific user from the management API to monitor conversations and manage communications.

Instructions

Get top chat messages from LinkedIn management API. Account ID is taken from environment.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
companyNoCompany URN where the account is admin (format: company:123456)
countNoMax messages to return
timeoutNoTimeout in seconds
userYesUser URN for filtering messages (must include prefix, e.g. fsd_profile:ACoAA...)

Implementation Reference

  • The core handler function for the 'get_linkedin_chat_messages' tool. Normalizes the user URN, validates it, constructs the API request payload including account_id, calls the AnySite API endpoint for chat messages, and returns the JSON response or an error message.
    async ({ user, company, count, timeout }) => {
      const normalizedUser = normalizeUserURN(user);
      if (!isValidUserURN(normalizedUser)) {
        return {
          content: [{ type: "text", text: "Invalid URN format. Must start with 'fsd_profile:'" }],
          isError: true
        };
      }
      const requestData: any = { timeout, user: normalizedUser, count, account_id: ACCOUNT_ID };
      if (company) requestData.company = company;
      log("Starting LinkedIn chat messages lookup for user:", normalizedUser);
      try {
        const response = await makeRequest(API_CONFIG.ENDPOINTS.CHAT_MESSAGES, requestData);
        return {
          content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
        };
      } catch (error) {
        log("LinkedIn chat messages lookup error:", error);
        return {
          content: [{ type: "text", text: `LinkedIn chat messages API error: ${formatError(error)}` }],
          isError: true
        };
      }
  • Zod input schema defining parameters for the tool: user URN (required), optional company URN, count (default 20), timeout (default 300).
      user: z.string().describe("User URN (must include prefix)"),
      company: z.string().optional().describe("Company URN"),
      count: z.number().default(20).describe("Max messages"),
      timeout: z.number().default(300).describe("Timeout in seconds")
    },
  • src/index.ts:827-860 (registration)
    MCP server tool registration call that defines the tool name, description, input schema, and points to the handler function.
    server.tool(
      "get_linkedin_chat_messages",
      "Get LinkedIn chat messages (requires ACCOUNT_ID)",
      {
        user: z.string().describe("User URN (must include prefix)"),
        company: z.string().optional().describe("Company URN"),
        count: z.number().default(20).describe("Max messages"),
        timeout: z.number().default(300).describe("Timeout in seconds")
      },
      async ({ user, company, count, timeout }) => {
        const normalizedUser = normalizeUserURN(user);
        if (!isValidUserURN(normalizedUser)) {
          return {
            content: [{ type: "text", text: "Invalid URN format. Must start with 'fsd_profile:'" }],
            isError: true
          };
        }
        const requestData: any = { timeout, user: normalizedUser, count, account_id: ACCOUNT_ID };
        if (company) requestData.company = company;
        log("Starting LinkedIn chat messages lookup for user:", normalizedUser);
        try {
          const response = await makeRequest(API_CONFIG.ENDPOINTS.CHAT_MESSAGES, requestData);
          return {
            content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
          };
        } catch (error) {
          log("LinkedIn chat messages lookup error:", error);
          return {
            content: [{ type: "text", text: `LinkedIn chat messages API error: ${formatError(error)}` }],
            isError: true
          };
        }
      }
    );
  • Helper function used in the handler to normalize user URN by prepending 'fsd_profile:' if missing.
    const normalizeUserURN = (urn: string): string => {
      if (!urn.includes("fsd_profile:")) {
        return `fsd_profile:${urn}`;
      }
      return urn;
  • API endpoint configuration used by the handler for fetching LinkedIn chat messages.
    CHAT_MESSAGES: "/api/linkedin/management/chat/messages",
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the account ID source but doesn't describe what 'top' means (recency? engagement?), whether this is a read-only operation, potential rate limits, error conditions, or what format the messages are returned in. The description provides minimal behavioral context beyond the basic operation.

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

Conciseness4/5

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

The description is appropriately concise with two sentences that convey essential information. The first sentence states the core functionality, and the second provides important authentication context. No unnecessary words or redundant information is present.

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

Completeness2/5

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

For a tool with 4 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what 'top' means in the context of chat messages, doesn't describe the return format or structure, and provides minimal behavioral context. The authentication note is helpful but doesn't compensate for the overall lack of completeness.

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?

Schema description coverage is 100%, so the input schema already documents all parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no parameter info in the description.

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

Purpose4/5

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

The description clearly states the action ('Get top chat messages') and resource ('LinkedIn management API'), making the purpose understandable. However, it doesn't differentiate this tool from sibling tools like 'get_linkedin_conversations' or 'send_linkedin_chat_message', which would require more specific scope definition.

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?

The description mentions that 'Account ID is taken from environment' which provides some context about authentication, but offers no guidance on when to use this tool versus alternatives like 'get_linkedin_conversations' or 'send_linkedin_chat_message'. No explicit when/when-not scenarios or sibling tool comparisons are provided.

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/anysiteio/hdw-mcp-server'

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