send_message
Send direct messages to LinkedIn connections using profile ID, subject, and body. Facilitates secure and structured communication with your network through the Model Context Protocol.
Instructions
Send direct messages to your LinkedIn connections
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | Message body | |
| recipientId | Yes | Recipient LinkedIn profile ID | |
| subject | Yes | Message subject |
Implementation Reference
- src/services/client.service.ts:192-202 (handler)Core handler function that constructs the message payload and sends it to the LinkedIn /messages API endpoint using makeRequest.public async sendMessage(params: SendMessageParams): Promise<MessageResponse> { const messageData = { recipients: { person: params.recipientUrn }, subject: params.subject, body: params.messageBody, messageType: 'INMAIL' } return this.makeRequest<MessageResponse>('post', '/messages', messageData) }
- src/server.ts:124-141 (registration)Registers the 'send-message' MCP tool with description, input schema, and an inline handler that logs, calls clientService.sendMessage, and formats the response.// Send Message Tool this.server.tool( 'send-message', 'Send a message to a LinkedIn connection', linkedinApiSchemas.sendMessage, async (params) => { this.logger.info('Sending LinkedIn Message', { recipientUrn: params.recipientUrn }) try { const result = await this.clientService.sendMessage(params) return this.createResourceResponse(result) } catch (error) { this.logger.error('LinkedIn Message Sending Failed', error) throw error } } )
- src/schemas/linkedin.schema.ts:43-50 (schema)Zod schema defining the input parameters for the sendMessage tool: recipientUrn, messageBody, and optional subject./** * Schema for sending messages on LinkedIn */ sendMessage: { messageBody: z.string().describe('Content of the message to send'), recipientUrn: z.string().describe('URN of the message recipient'), subject: z.string().optional().default('LinkedIn Connection').describe('Subject of the message') }