Skip to main content
Glama

send_message

Send LinkedIn messages to specific contacts using their profile URL and custom text, enabling direct professional communication through the Linked API MCP server.

Instructions

Allows you to send a message to a person (st.sendMessage action).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
personUrlYesLinkedIn URL of the person you want to send a message to (e.g., 'https://www.linkedin.com/in/john-doe')
textYesThe message text, must be up to 1900 characters.

Implementation Reference

  • Primary implementation of the 'send_message' tool: defines name, operation name, Zod schema for validation, and MCP tool specification via getTool(). Execution handled by inherited OperationTool.execute().
    export class SendMessageTool extends OperationTool<TSendMessageParams, unknown> { public override readonly name = 'send_message'; public override readonly operationName = OPERATION_NAME.sendMessage; protected override readonly schema = z.object({ personUrl: z.string(), text: z.string().min(1), }); public override getTool(): Tool { return { name: this.name, description: 'Allows you to send a message to a person (st.sendMessage action).', inputSchema: { type: 'object', properties: { personUrl: { type: 'string', description: "LinkedIn URL of the person you want to send a message to (e.g., 'https://www.linkedin.com/in/john-doe')", }, text: { type: 'string', description: 'The message text, must be up to 1900 characters.', }, }, required: ['personUrl', 'text'], }, }; } }
  • Core execution handler for 'send_message' (and other operation tools): locates the specific LinkedAPI operation by operationName and executes it with progress reporting.
    public override execute({ linkedapi, args, workflowTimeout, progressToken, }: { linkedapi: LinkedApi; args: TParams; workflowTimeout: number; progressToken?: string | number; }): Promise<TMappedResponse<TResult>> { const operation = linkedapi.operations.find( (operation) => operation.operationName === this.operationName, )! as Operation<TParams, TResult>; return executeWithProgress(this.progressCallback, operation, workflowTimeout, { params: args, progressToken, }); }
  • Helper function invoked by OperationTool.execute: performs the actual workflow execution, progress notifications, result polling, and timeout handling for send_message.
    export async function executeWithProgress<TParams, TResult>( progressCallback: (progress: LinkedApiProgressNotification) => void, operation: Operation<TParams, TResult>, workflowTimeout: number, { params, workflowId, progressToken, }: { params?: TParams; workflowId?: string; progressToken?: string | number } = {}, ): Promise<TMappedResponse<TResult>> { let progress = 0; progressCallback({ progressToken, progress, total: 100, message: `Starting workflow ${operation.operationName}...`, }); const interval = setInterval( () => { if (progress < 50) { progress += 5; } else if (progress < 98) { progress += 1; } progressCallback({ progressToken, progress, total: 100, message: `Executing workflow ${operation.operationName}...`, }); }, Math.max(workflowTimeout / 20, 10000), ); try { if (!workflowId) { workflowId = await operation.execute(params as TParams); } const result = await operation.result(workflowId, { timeout: workflowTimeout, }); clearInterval(interval); progressCallback({ progressToken, progress: 100, total: 100, message: `Workflow ${operation.operationName} completed successfully`, }); return result; } catch (error) { clearInterval(interval); if (error instanceof LinkedApiWorkflowTimeoutError) { throw generateTimeoutError(error); } throw error; } }
  • Tool registration: instantiates SendMessageTool and includes it in the array of available tools.
    constructor(progressCallback: (progress: LinkedApiProgressNotification) => void) { this.tools = [ // Standard tools new SendMessageTool(progressCallback), new GetConversationTool(progressCallback), new CheckConnectionStatusTool(progressCallback), new RetrieveConnectionsTool(progressCallback), new SendConnectionRequestTool(progressCallback), new WithdrawConnectionRequestTool(progressCallback), new RetrievePendingRequestsTool(progressCallback), new RemoveConnectionTool(progressCallback), new SearchCompaniesTool(progressCallback), new SearchPeopleTool(progressCallback), new FetchCompanyTool(progressCallback), new FetchPersonTool(progressCallback), new FetchPostTool(progressCallback), new ReactToPostTool(progressCallback), new CommentOnPostTool(progressCallback), new CreatePostTool(progressCallback), new RetrieveSSITool(progressCallback), new RetrievePerformanceTool(progressCallback), // Sales Navigator tools new NvSendMessageTool(progressCallback), new NvGetConversationTool(progressCallback), new NvSearchCompaniesTool(progressCallback), new NvSearchPeopleTool(progressCallback), new NvFetchCompanyTool(progressCallback), new NvFetchPersonTool(progressCallback), // Other tools new ExecuteCustomWorkflowTool(progressCallback), new GetWorkflowResultTool(progressCallback), new GetApiUsageTool(progressCallback), ];
  • MCP server registration: exposes send_message tool specification by mapping all tools to their MCP Tool objects via getTool().
    public getTools(): Tool[] { return this.tools.tools.map((tool) => tool.getTool()); }
  • Zod schema for input validation of send_message parameters.
    protected override readonly schema = z.object({ personUrl: z.string(), text: z.string().min(1), });

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/Linked-API/linkedapi-mcp'

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