Skip to main content
Glama

add-comment

Add comments to Trello cards by specifying the card ID and comment text to provide updates, feedback, or notes within project boards.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cardIdYesID of the card to comment on
textYesComment text

Implementation Reference

  • Handler function that executes the logic to add a comment to a Trello card by posting to the Trello API endpoint.
    async ({ cardId, text }) => { try { const response = await fetch( `https://api.trello.com/1/cards/${cardId}/actions/comments?key=${trelloApiKey}&token=${trelloApiToken}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ text, }), } ); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error adding comment: ${error}`, }, ], isError: true, }; } }
  • Input schema validation using Zod for the 'add-comment' tool parameters: cardId and text.
    { cardId: z.string().describe('ID of the card to comment on'), text: z.string().describe('Comment text'), },
  • src/index.ts:286-327 (registration)
    Registration of the 'add-comment' tool with the MCP server using server.tool(), including schema and handler.
    server.tool( 'add-comment', { cardId: z.string().describe('ID of the card to comment on'), text: z.string().describe('Comment text'), }, async ({ cardId, text }) => { try { const response = await fetch( `https://api.trello.com/1/cards/${cardId}/actions/comments?key=${trelloApiKey}&token=${trelloApiToken}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ text, }), } ); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error adding comment: ${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