trello_get_card_actions
Retrieve activity history and comments for a specific Trello card to track changes and discussions.
Instructions
Get activity history and comments for a specific Trello card. Useful for tracking changes and discussions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiKey | No | Trello API key (optional if TRELLO_API_KEY env var is set) | |
| token | No | Trello API token (optional if TRELLO_TOKEN env var is set) | |
| cardId | Yes | ID or URL of the card (e.g. "abc123" or "https://trello.com/c/abc123/1-title") | |
| filter | No | Filter actions by type: "commentCard" for comments only, "updateCard" for updates | commentCard |
| limit | No | Maximum number of actions to return |
Implementation Reference
- src/tools/advanced.ts:372-437 (handler)Main handler function that executes the 'trello_get_card_actions' tool logic. Extracts credentials, validates params (cardId, filter, limit), calls TrelloClient.getCardActions(), and formats the response with action details (type, date, member, data).
export async function handleTrelloGetCardActions(args: unknown) { try { const { credentials, params } = extractCredentials(args); const { cardId, filter, limit} = validateGetCardActions(params); const client = new TrelloClient(credentials); const response = await client.getCardActions(cardId, { ...(filter && { filter }), ...(limit !== undefined && { limit }) }); const actions = response.data; const result = { summary: `Found ${actions.length} action(s) for card`, cardId, actions: actions.map(action => ({ id: action.id, type: action.type, date: action.date, memberCreator: action.memberCreator ? { id: action.memberCreator.id, fullName: action.memberCreator.fullName, username: action.memberCreator.username } : null, data: { text: action.data?.text, old: action.data?.old, card: action.data?.card ? { id: action.data.card.id, name: action.data.card.name } : null, list: action.data?.list ? { id: action.data.list.id, name: action.data.list.name } : null } })), rateLimit: response.rateLimit }; return { content: [ { type: 'text' as const, text: JSON.stringify(result, null, 2) } ] }; } catch (error) { const errorMessage = error instanceof z.ZodError ? formatValidationError(error) : error instanceof Error ? error.message : 'Unknown error occurred'; return { content: [ { type: 'text' as const, text: `Error getting card actions: ${errorMessage}` } ], isError: true }; } } - src/tools/advanced.ts:335-370 (schema)Tool definition with input schema. Defines 'trello_get_card_actions' tool with parameters: cardId (required), filter (enum: all/commentCard/updateCard/createCard, default commentCard), limit (1-1000, default 50), plus optional apiKey and token.
export const trelloGetCardActionsTool: Tool = { name: 'trello_get_card_actions', description: 'Get activity history and comments for a specific Trello card. Useful for tracking changes and discussions.', inputSchema: { type: 'object', properties: { apiKey: { type: 'string', description: 'Trello API key (optional if TRELLO_API_KEY env var is set)' }, token: { type: 'string', description: 'Trello API token (optional if TRELLO_TOKEN env var is set)' }, cardId: { type: 'string', description: 'ID or URL of the card (e.g. "abc123" or "https://trello.com/c/abc123/1-title")', }, filter: { type: 'string', enum: ['all', 'commentCard', 'updateCard', 'createCard'], description: 'Filter actions by type: "commentCard" for comments only, "updateCard" for updates', default: 'commentCard' }, limit: { type: 'number', minimum: 1, maximum: 1000, description: 'Maximum number of actions to return', default: 50 } }, required: ['cardId'] } }; - src/tools/advanced.ts:37-46 (schema)Validation schema for getCardActions using Zod. Validates cardId (trelloIdSchema), filter (optional string), and limit (optional number 1-1000).
const validateGetCardActions = (args: unknown) => { const schema = z.object({ cardId: trelloIdSchema, filter: z.string().optional(), limit: z.number().min(1).max(1000).optional() }); return schema.parse(args); }; - src/trello/client.ts:569-587 (helper)TrelloClient.getCardActions() method that makes the actual API call to GET /cards/{cardId}/actions with optional filter and limit parameters.
async getCardActions(cardId: string, options?: { filter?: string; limit?: number; }): Promise<TrelloApiResponse<TrelloAction[]>> { const params: Record<string, string> = {}; if (options?.filter) { params.filter = options.filter; } if (options?.limit) { params.limit = options.limit.toString(); } return this.makeRequest<TrelloAction[]>( `/cards/${cardId}/actions`, { params }, `Get actions for card ${cardId}` ); } - src/server.ts:53-54 (registration)Import of trelloGetCardActionsTool and handleTrelloGetCardActions from advanced.ts into the server module.
trelloGetCardActionsTool, handleTrelloGetCardActions,