Skip to main content
Glama
PhononX

Carbon Voice

by PhononX

add_attachments_to_message

Attach files or links to existing messages in Carbon Voice conversations. Provide a message ID and attachment links to enhance communication with additional content.

Instructions

Add attachments to a message. In order to add attachments to a message, you must provide a message id and the attachments.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
linksYesArray of links to be attached to the message

Implementation Reference

  • The handler function for the 'add_attachments_to_message' MCP tool. It extracts the message ID and links from args, calls the simplifiedApi to add link attachments, and formats the response.
      async (
        args: AddLinkAttachmentsToMessageInput,
        { authInfo },
      ): Promise<McpToolResponse> => {
        try {
          return formatToMCPToolResponse(
            await simplifiedApi.addLinkAttachmentsToMessage(
              args.id,
              {
                links: args.links,
              },
              setCarbonVoiceAuthHeader(authInfo?.token),
            ),
          );
        } catch (error) {
          logger.error('Error adding attachments to message:', { args, error });
          return formatToMCPToolResponse(error);
        }
      },
    );
  • src/server.ts:272-304 (registration)
    Registration of the 'add_attachments_to_message' tool with description, input schema merged from params and body, and annotations.
    server.registerTool(
      'add_attachments_to_message',
      {
        description:
          'Add attachments to a message. In order to add attachments to a message, you must provide a message id and the attachments.',
        inputSchema: addLinkAttachmentsToMessageParams.merge(
          addLinkAttachmentsToMessageBody,
        ).shape,
        annotations: {
          readOnlyHint: false,
          destructiveHint: false,
        },
      },
      async (
        args: AddLinkAttachmentsToMessageInput,
        { authInfo },
      ): Promise<McpToolResponse> => {
        try {
          return formatToMCPToolResponse(
            await simplifiedApi.addLinkAttachmentsToMessage(
              args.id,
              {
                links: args.links,
              },
              setCarbonVoiceAuthHeader(authInfo?.token),
            ),
          );
        } catch (error) {
          logger.error('Error adding attachments to message:', { args, error });
          return formatToMCPToolResponse(error);
        }
      },
    );
  • Zod schema definitions for the input parameters (message id) and body (array of links) used in the tool's inputSchema.
    export const addLinkAttachmentsToMessageParams = zod.object({
      "id": zod.string()
    })
    
    export const addLinkAttachmentsToMessageBody = zod.object({
      "links": zod.array(zod.string()).describe('Array of links to be attached to the message')
    })
  • TypeScript type definitions inferred from the Zod schemas for the tool input, used in the handler signature.
    type AddLinkAttachmentsToMessageParams = z.infer<
      typeof addLinkAttachmentsToMessageParams
    >;
    type AddLinkAttachmentsToMessageBody = z.infer<
      typeof addLinkAttachmentsToMessageBody
    >;
    export type AddLinkAttachmentsToMessageInput =
      AddLinkAttachmentsToMessageParams & AddLinkAttachmentsToMessageBody;
  • Generated API client function called by the handler, which performs a POST request to add link attachments to the specified message.
    const addLinkAttachmentsToMessage = (
      id: string,
      addLinkAttachmentPayload: AddLinkAttachmentPayload,
      options?: SecondParameter<typeof mutator>,
    ) => {
      return mutator<AddAttachmentsResponse>(
        {
          url: `/simplified/messages/${id}/attachments/bulk/link`,
          method: 'POST',
          headers: { 'Content-Type': 'application/json' },
          data: addLinkAttachmentPayload,
        },
        options,
      );
    };
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, which the description aligns with by implying a mutation ('add attachments'). The description adds minimal behavioral context beyond annotations, specifying required inputs but not detailing effects like whether attachments are appended or replaced, or any rate limits.

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 with the core purpose, using two sentences efficiently. However, the second sentence is somewhat redundant, restating prerequisites already implied, which slightly reduces conciseness.

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

Completeness2/5

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

For a mutation tool with no output schema and 50% schema coverage, the description is incomplete. It lacks details on return values, error conditions, or how attachments are handled (e.g., file types, size limits). Given the complexity and sibling tools, more context is needed for effective use.

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?

Schema description coverage is 50%, with only the 'links' parameter described. The description mentions 'message id' and 'attachments', which map to 'id' and 'links' parameters, adding some meaning but not compensating fully for the coverage gap. It doesn't explain parameter formats or constraints 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 ('add attachments') and target resource ('to a message'), which is specific and unambiguous. However, it doesn't distinguish this tool from sibling tools like 'create_conversation_message' or 'create_direct_message' that might also handle attachments, missing explicit differentiation.

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 no guidance on when to use this tool versus alternatives. It mentions prerequisites (message id and attachments) but doesn't clarify scenarios like adding attachments to existing messages versus creating new ones with attachments, nor does it reference sibling tools for context.

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