Skip to main content
Glama
PhononX

Carbon Voice

by PhononX

create_direct_message

Send direct messages to users or groups with text-to-speech audio generation and link attachments in Carbon Voice.

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

Implementation Reference

  • Inline asynchronous handler function that executes the core logic of the 'create_direct_message' tool: calls simplifiedApi.sendDirectMessage with args and auth token, formats the response, and handles errors.
    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);
      }
    },
  • src/server.ts:216-241 (registration)
    Registration of the 'create_direct_message' MCP tool, specifying description, input schema (sendDirectMessageBody.shape), annotations, and inline handler.
    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);
        }
      },
    );
  • Zod input schema definition (sendDirectMessageBody) for validating tool arguments, including 'to' recipients, workspace_id, transcript, links, etc. Referenced as inputSchema.shape in registration.
    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)')
    })
  • API helper function simplifiedApi.sendDirectMessage: performs POST request to /simplified/messages/direct with SendDirectMessage payload, called by the tool handler.
    const sendDirectMessage = (
      sendDirectMessage: SendDirectMessage,
      options?: SecondParameter<typeof mutator>,
    ) => {
      return mutator<GetMessageResponse>(
        {
          url: `/simplified/messages/direct`,
          method: 'POST',
          headers: { 'Content-Type': 'application/json' },
          data: sendDirectMessage,
        },
        options,
      );
    };
  • TypeScript interface SendDirectMessage defining the shape of arguments for the tool and API call.
    export interface SendDirectMessage {
      to: ToRecipient;
      /** The workspace ID to send the message to */
      workspace_id?: string;
      /** 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?: SendDirectMessageFromMessageType;
      /** Message ID to be used as a base for the new message. (Optional only when from_message_type is NewMessage) */
      from_message_id?: string;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate this is a non-read-only, non-destructive operation (readOnlyHint: false, destructiveHint: false), which the description aligns with by implying a creation action ('Send'). The description adds some behavioral context by specifying the requirement for attachments, but does not elaborate on permissions, rate limits, or other side effects beyond what annotations provide.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is brief and front-loaded, consisting of two sentences that directly state the tool's purpose and a key requirement. There is no unnecessary elaboration, making it efficient, though it could be slightly more structured to better highlight critical information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (6 parameters, nested objects) and lack of an output schema, the description is somewhat incomplete. It covers the basic action and attachment requirement but does not address error conditions, response format, or interactions with sibling tools, leaving gaps for the agent to navigate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With a high schema description coverage of 83%, the input schema already documents most parameters well. The description adds minimal value by hinting at the need for 'transcript or link attachments,' which loosely relates to the 'transcript' and 'links' parameters but does not provide additional semantics or clarify usage beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Send a Direct Message') and target ('to a User or a Group of Users'), which is specific and actionable. However, it does not explicitly differentiate from sibling tools like 'create_conversation_message' or 'create_voicememo_message', leaving some ambiguity about when to choose this tool over alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal guidance by stating 'you must provide transcript or link attachments,' but this is a requirement rather than contextual advice. It offers no explicit when-to-use or when-not-to-use instructions, nor does it mention alternatives among sibling tools, leaving the agent to infer usage scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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