Skip to main content
Glama

add-comments

Add comments to Trello cards to provide updates, feedback, or notes for team collaboration and task tracking.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commentsYes

Implementation Reference

  • Handler function that processes an array of comments, posting each to the corresponding Trello card via the API, and returns the results or an error message.
    async ({ comments }) => { try { const results = await Promise.all( comments.map(async (comment) => { const response = await fetch( `https://api.trello.com/1/cards/${comment.cardId}/actions/comments?key=${trelloApiKey}&token=${trelloApiToken}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ text: comment.text, }), } ); return await response.json(); }) ); return { content: [ { type: 'text', text: JSON.stringify(results), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error adding comments: ${error}`, }, ], isError: true, }; } }
  • Zod schema for the tool input parameters: an array of comment objects, each containing cardId (string) and text (string).
    { comments: z.array( z.object({ cardId: z.string().describe('ID of the card to comment on'), text: z.string().describe('Comment text'), }) ), },
  • src/index.ts:473-522 (registration)
    Registration of the 'add-comments' tool using server.tool(), including name, input schema, and handler function.
    server.tool( 'add-comments', { comments: z.array( z.object({ cardId: z.string().describe('ID of the card to comment on'), text: z.string().describe('Comment text'), }) ), }, async ({ comments }) => { try { const results = await Promise.all( comments.map(async (comment) => { const response = await fetch( `https://api.trello.com/1/cards/${comment.cardId}/actions/comments?key=${trelloApiKey}&token=${trelloApiToken}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ text: comment.text, }), } ); return await response.json(); }) ); return { content: [ { type: 'text', text: JSON.stringify(results), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error adding comments: ${error}`, }, ], isError: true, }; } } );

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/praveencs87/trello-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server