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
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| links | Yes | Array of links to be attached to the message |
Implementation Reference
- src/server.ts:285-304 (handler)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, ); };