create_conversation_message
Send messages to Carbon Voice conversations by providing a transcript or attachment. Reply as a thread using a parent_id or create new messages in existing conversations.
Instructions
Sends a message to an existing conversation or any type with a conversation_id. To reply as a thread, included a message_id for "parent_id". You must provide a transcript or attachment.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from_message_id | No | Message ID to be used as a base for the new message. (Optional only when from_message_type is NewMessage) | |
| from_message_type | No | From Message type | NewMessage |
| id | Yes | ||
| links | No | Array of links to be attached to the message | |
| transcript | No | The Message transcript will be used to generate audio using text-to-speech |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"from_message_id": {
"description": "Message ID to be used as a base for the new message. (Optional only when from_message_type is NewMessage)",
"type": "string"
},
"from_message_type": {
"default": "NewMessage",
"description": "From Message type",
"enum": [
"PreRecorded",
"NewMessage",
"Forward"
],
"type": "string"
},
"id": {
"type": "string"
},
"links": {
"description": "Array of links to be attached to the message",
"items": {
"type": "string"
},
"type": "array"
},
"transcript": {
"description": "The Message transcript will be used to generate audio using text-to-speech",
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
}
Implementation Reference
- src/server.ts:183-214 (registration)Registration of the MCP tool 'create_conversation_message' with input schema, description, annotations, and handler function that calls the simplified API with authentication.server.registerTool( 'create_conversation_message', { description: 'Sends a message to an existing conversation or any type with a conversation_id. ' + 'To reply as a thread, included a message_id for "parent_id". You must provide a transcript or attachment.', inputSchema: createConversationMessageParams.merge( createConversationMessageBody, ).shape, annotations: { readOnlyHint: false, destructiveHint: false, }, }, async ( args: CreateConversationMessageInput, { authInfo }, ): Promise<McpToolResponse> => { try { return formatToMCPToolResponse( await simplifiedApi.createConversationMessage( args.id, args, setCarbonVoiceAuthHeader(authInfo?.token), ), ); } catch (error) { logger.error('Error creating conversation message:', { args, error }); return formatToMCPToolResponse(error); } }, );
- Zod schema definitions for the input parameters (conversation ID) and body (transcript, links, from_message_type, from_message_id) merged in MCP tool inputSchema.export const createConversationMessageParams = zod.object({ "id": zod.string() }) export const createConversationMessageBodyFromMessageTypeDefault = "NewMessage"; export const createConversationMessageBody = zod.object({ "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(createConversationMessageBodyFromMessageTypeDefault).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)') })
- TypeScript type CreateConversationMessageInput inferred from the Zod schemas, used as args type in MCP handler.type CreateConversationMessageParams = z.infer< typeof createConversationMessageParams >; type CreateConversationMessageBody = z.infer< typeof createConversationMessageBody >; export type CreateConversationMessageInput = CreateConversationMessageParams & CreateConversationMessageBody;
- Generated API client function implementing the POST request to create a conversation message, called by the MCP tool handler.const createConversationMessage = ( id: string, createConversationMessage: CreateConversationMessage, options?: SecondParameter<typeof mutator>, ) => { return mutator<GetMessageResponse>( { url: `/simplified/messages/conversation/${id}`, method: 'POST', headers: { 'Content-Type': 'application/json' }, data: createConversationMessage, }, options, ); };
- TypeScript interface defining the structure of the request body for the createConversationMessage API.export interface CreateConversationMessage { /** The Message transcript will be used to generate audio using text-to-speech */ transcript?: string; /** Array of links to be attached to the message */ links?: string[]; /** From Message type */ from_message_type?: CreateConversationMessageFromMessageType; /** Message ID to be used as a base for the new message. (Optional only when from_message_type is NewMessage) */ from_message_id?: string; }