Skip to main content
Glama

add_attachments_to_message

Enhance messages on Carbon Voice by attaching links or files. Provide the message ID and attachment URLs to include additional resources in your communication.

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

NameRequiredDescriptionDefault
idYes
linksYesArray of links to be attached to the message

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "id": { "type": "string" }, "links": { "description": "Array of links to be attached to the message", "items": { "type": "string" }, "type": "array" } }, "required": [ "id", "links" ], "type": "object" }

Implementation Reference

  • The handler function for the MCP tool 'add_attachments_to_message'. It takes input args including message ID and links, calls the generated simplifiedApi to POST attachments, formats the response, and handles errors.
    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 MCP tool 'add_attachments_to_message' on the McpServer instance, including description, input schema, annotations, and handler reference.
    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 inferring from the Zod schemas for the combined input type AddLinkAttachmentsToMessageInput used in the handler.
    type AddLinkAttachmentsToMessageParams = z.infer< typeof addLinkAttachmentsToMessageParams >; type AddLinkAttachmentsToMessageBody = z.infer< typeof addLinkAttachmentsToMessageBody >; export type AddLinkAttachmentsToMessageInput = AddLinkAttachmentsToMessageParams & AddLinkAttachmentsToMessageBody;
  • Generated API client function simplifiedApi.addLinkAttachmentsToMessage that performs the actual HTTP POST request to add link attachments to a message, invoked by the MCP handler.
    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, ); };

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