trello_get_list_cards
Get all cards in a Trello list to view tasks in a workflow column. Supports filtering by status and selecting specific fields.
Instructions
Get all cards in a specific Trello list. Use this to see all tasks/items in a workflow column.
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) | |
| listId | Yes | ID of the list to get cards from (you can get this from get_lists) | |
| filter | No | Filter cards by status: "open" for active cards, "closed" for archived cards, "all" for both | open |
| fields | No | Optional: specific fields to include (e.g., ["name", "desc", "due", "labels", "members"]) | |
| compact | No | Return minimal fields only (id, name, url, listId). Default: true. Set to false for full details. |
Implementation Reference
- src/tools/lists.ts:75-155 (handler)Main handler function for trello_get_list_cards. Extracts credentials, validates inputs (listId, filter, fields, compact), calls TrelloClient.getListCards(), and returns formatted card data (compact or full mode).
export async function handleTrelloGetListCards(args: unknown) { try { const { credentials, params } = extractCredentials(args); const { listId, filter, fields, compact } = validateGetListCards(params); const client = new TrelloClient(credentials); // Default to compact mode for smaller responses const useCompact = compact ?? true; const response = await client.getListCards(listId, { ...(filter && { filter }), ...(fields && { fields }) }); const cards = response.data; const result = useCompact ? { summary: `Found ${cards.length} ${filter || 'open'} card(s) in list`, listId, cards: cards.map(card => ({ id: card.id, name: card.name, url: card.shortUrl, listId: card.idList })), rateLimit: response.rateLimit } : { summary: `Found ${cards.length} ${filter || 'open'} card(s) in list`, listId, cards: cards.map(card => ({ id: card.id, name: card.name, description: card.desc || 'No description', url: card.shortUrl, listId: card.idList, boardId: card.idBoard, position: card.pos, due: card.due, dueComplete: card.dueComplete, start: card.start, closed: card.closed, lastActivity: card.dateLastActivity, labels: card.labels?.map(label => ({ id: label.id, name: label.name, color: label.color })) || [], members: card.members?.map(member => ({ id: member.id, fullName: member.fullName, username: member.username })) || [] })), 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 list cards: ${errorMessage}` } ], isError: true }; } } - src/tools/lists.ts:6-15 (schema)Validation schema for get_list_cards inputs using Zod. Validates listId, filter (all/open/closed), fields (array of strings), and compact (boolean).
const validateGetListCards = (args: unknown) => { const schema = z.object({ listId: trelloIdSchema, filter: z.enum(['all', 'open', 'closed']).optional(), fields: z.array(z.string()).optional(), compact: z.boolean().optional() }); return schema.parse(args); }; - src/tools/lists.ts:36-73 (registration)Tool definition with name 'trello_get_list_cards', description, and inputSchema (JSON Schema) listing apiKey, token, listId, filter, fields, compact parameters.
export const trelloGetListCardsTool: Tool = { name: 'trello_get_list_cards', description: 'Get all cards in a specific Trello list. Use this to see all tasks/items in a workflow column.', 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)' }, listId: { type: 'string', description: 'ID of the list to get cards from (you can get this from get_lists)' }, filter: { type: 'string', enum: ['all', 'open', 'closed'], description: 'Filter cards by status: "open" for active cards, "closed" for archived cards, "all" for both', default: 'open' }, fields: { type: 'array', items: { type: 'string' }, description: 'Optional: specific fields to include (e.g., ["name", "desc", "due", "labels", "members"])' }, compact: { type: 'boolean', description: 'Return minimal fields only (id, name, url, listId). Default: true. Set to false for full details.', default: true } }, required: ['listId'] } }; - src/index.ts:188-190 (registration)Tool registration in the tool list array in index.ts (Express server).
trelloGetListCardsTool, trelloCreateListTool, // Original tools (maintained for compatibility) - src/trello/client.ts:453-471 (helper)TrelloClient.getListCards() helper method. Makes API request to /lists/{listId}/cards with optional filter and fields parameters.
async getListCards(listId: string, options?: { filter?: 'all' | 'open' | 'closed'; fields?: string[]; }): Promise<TrelloApiResponse<TrelloCard[]>> { const params: Record<string, string> = {}; if (options?.filter) { params.filter = options.filter; } if (options?.fields) { params.fields = options.fields.join(','); } return this.makeRequest<TrelloCard[]>( `/lists/${listId}/cards`, { params }, `Get cards in list ${listId}` ); }