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",

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