Skip to main content
Glama

create_direct_message

Send direct messages with audio transcripts or link attachments to users or groups on Carbon Voice. Specify recipients by user IDs or emails and include workspace details for delivery.

Instructions

Send a Direct Message (DM) to a User or a Group of Users. In order to create a Direct Message, you must provide transcript or link attachments.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_message_idNoMessage ID to be used as a base for the new message. (Optional only when from_message_type is NewMessage)
from_message_typeNoFrom Message typeNewMessage
linksNoArray of links to be attached to the message
toYes
transcriptNoThe Message transcript will be used to generate audio using text-to-speech
workspace_idNoThe workspace ID to send the message topersonal

Implementation Reference

  • src/server.ts:216-241 (registration)
    Registers the 'create_direct_message' tool with server.registerTool, including description, input schema reference, annotations, and an inline async handler that calls the simplified API's sendDirectMessage method and formats the response.
    server.registerTool( 'create_direct_message', { description: 'Send a Direct Message (DM) to a User or a Group of Users. ' + 'In order to create a Direct Message, you must provide transcript or link attachments.', inputSchema: sendDirectMessageBody.shape, annotations: { readOnlyHint: false, destructiveHint: false, }, }, async (args: SendDirectMessage, { authInfo }): Promise<McpToolResponse> => { try { return formatToMCPToolResponse( await simplifiedApi.sendDirectMessage( args, setCarbonVoiceAuthHeader(authInfo?.token), ), ); } catch (error) { logger.error('Error creating direct message:', { args, error }); return formatToMCPToolResponse(error); } }, );
  • The inline handler function for the create_direct_message tool. It invokes simplifiedApi.sendDirectMessage with the input arguments and authentication header, then formats the response or error using formatToMCPToolResponse.
    async (args: SendDirectMessage, { authInfo }): Promise<McpToolResponse> => { try { return formatToMCPToolResponse( await simplifiedApi.sendDirectMessage( args, setCarbonVoiceAuthHeader(authInfo?.token), ), ); } catch (error) { logger.error('Error creating direct message:', { args, error }); return formatToMCPToolResponse(error); } },
  • Zod input schema (sendDirectMessageBody) used by the tool for validation, defining parameters like 'to' (user_ids or emails), workspace_id, transcript, links, from_message_type, and from_message_id.
    export const sendDirectMessageBodyWorkspaceIdDefault = "personal";export const sendDirectMessageBodyFromMessageTypeDefault = "NewMessage"; export const sendDirectMessageBody = zod.object({ "to": zod.object({ "user_ids": zod.array(zod.string()).optional().describe('Array of user IDs to send the message to'), "emails": zod.array(zod.string()).optional().describe('Array of email addresses to send the message to') }), "workspace_id": zod.string().default(sendDirectMessageBodyWorkspaceIdDefault).describe('The workspace ID to send the message to'), "transcript": zod.string().optional().describe('The Message transcript will be used to generate audio using text-to-speech'), "links": zod.array(zod.string()).optional().describe('Array of links to be attached to the message'), "from_message_type": zod.enum(['PreRecorded', 'NewMessage', 'Forward']).default(sendDirectMessageBodyFromMessageTypeDefault).describe('From Message type'), "from_message_id": zod.string().optional().describe('Message ID to be used as a base for the new message. (Optional only when from_message_type is NewMessage)') })

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/PhononX/cv-mcp-server'

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