trello_get_card_checklists
Retrieve all checklists and their items from a specific Trello card. Provide the card ID or URL to fetch checklists with optional item inclusion and field selection.
Instructions
Get all checklists and their items for a specific Trello card.
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") | |
| checkItems | No | Include checklist items in response | all |
| fields | No | Optional: specific fields to include (e.g., ["name", "pos"]) |
Implementation Reference
- src/tools/advanced.ts:562-618 (handler)The main handler function for trello_get_card_checklists. It extracts credentials and params, validates input via validateGetCardChecklists, calls TrelloClient.getCardChecklists(), and formats the response with checklists and their items.
export async function handleTrelloGetCardChecklists(args: unknown) { try { const { credentials, params } = extractCredentials(args); const { cardId, checkItems, fields} = validateGetCardChecklists(params); const client = new TrelloClient(credentials); const response = await client.getCardChecklists(cardId, { ...(checkItems && { checkItems }), ...(fields && { fields }) }); const checklists = response.data; const result = { summary: `Found ${checklists.length} checklist(s) for card`, cardId, checklists: checklists.map(checklist => ({ id: checklist.id, name: checklist.name, position: checklist.pos, checkItems: checklist.checkItems?.map((item: any) => ({ id: item.id, name: item.name, state: item.state, position: item.pos, due: item.due, nameData: item.nameData })) || [] })), 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 checklists: ${errorMessage}` } ], isError: true }; } } - src/tools/advanced.ts:95-104 (schema)Validation schema for the getCardChecklists tool. Validates cardId (using trelloIdSchema), optional checkItems string, and optional fields array.
const validateGetCardChecklists = (args: unknown) => { const schema = z.object({ cardId: trelloIdSchema, checkItems: z.string().optional(), fields: z.array(z.string()).optional() }); return schema.parse(args); }; - src/tools/advanced.ts:527-560 (registration)Tool definition object for trello_get_card_checklists, including name, description, and inputSchema with apiKey, token, cardId (required), checkItems (enum all/none), and fields array.
export const trelloGetCardChecklistsTool: Tool = { name: 'trello_get_card_checklists', description: 'Get all checklists and their items for a specific Trello card.', 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")', }, checkItems: { type: 'string', enum: ['all', 'none'], description: 'Include checklist items in response', default: 'all' }, fields: { type: 'array', items: { type: 'string' }, description: 'Optional: specific fields to include (e.g., ["name", "pos"])' } }, required: ['cardId'] } }; - src/server.ts:57-58 (registration)Import of the tool definition and handler in the server entry point.
trelloGetCardChecklistsTool, handleTrelloGetCardChecklists, - src/server.ts:179-179 (registration)Registration of trelloGetCardChecklistsTool in the server's tool list.
trelloGetCardChecklistsTool, - src/server.ts:295-296 (registration)Routing of the 'trello_get_card_checklists' tool name to the handleTrelloGetCardChecklists handler function.
case 'trello_get_card_checklists': return await handleTrelloGetCardChecklists(args); - src/trello/client.ts:704-722 (helper)TrelloClient.getCardChecklists() method that makes the actual API call to GET /cards/{cardId}/checklists with optional checkItems and fields parameters.
async getCardChecklists(cardId: string, options?: { checkItems?: string; fields?: string[]; }): Promise<TrelloApiResponse<TrelloChecklist[]>> { const params: Record<string, string> = {}; if (options?.checkItems) { params.checkItems = options.checkItems; } if (options?.fields) { params.fields = options.fields.join(','); } return this.makeRequest<TrelloChecklist[]>( `/cards/${cardId}/checklists`, { params }, `Get checklists for card ${cardId}` ); } - src/types/trello.ts:95-111 (helper)TypeScript interfaces TrelloChecklist (id, name, idBoard, idCard, pos, checkItems) and TrelloCheckItem (id, name, state, pos, due, idMember) used by the tool.
export interface TrelloChecklist { id: string; name: string; idBoard: string; idCard: string; pos: number; checkItems: TrelloCheckItem[]; } export interface TrelloCheckItem { id: string; name: string; state: 'complete' | 'incomplete'; pos: number; due: string | null; idMember: string | null; }