list_boards
Retrieve all Trello boards you have access to. Filter by open, closed, or both to focus on active or archived boards.
Instructions
List all Trello boards accessible to the user. Use this to see all boards you have access to, or filter by status.
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) | |
| filter | No | Filter boards by status: "open" for active boards, "closed" for archived boards, "all" for both | open |
Implementation Reference
- src/tools/boards.ts:38-86 (handler)The main handler function for the 'list_boards' tool. Extracts credentials, validates params via the schema, calls the TrelloClient to fetch boards, and returns formatted results with board details (id, name, description, url, lastActivity, closed).
export async function handleListBoards(args: unknown) { try { const { credentials, params } = extractCredentials(args); const { filter } = validateListBoards(params); const client = new TrelloClient(credentials); const response = await client.getMyBoards(filter); const boards = response.data; const summary = `Found ${boards.length} ${filter} board(s)`; const boardList = boards.map(board => ({ id: board.id, name: board.name, description: board.desc || 'No description', url: board.shortUrl, lastActivity: board.dateLastActivity, closed: board.closed })); return { content: [ { type: 'text' as const, text: JSON.stringify({ summary, boards: boardList, rateLimit: response.rateLimit }, 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 listing boards: ${errorMessage}` } ], isError: true }; } } - src/utils/validation.ts:53-55 (schema)Zod schema for validating list_boards input. Defines a single optional 'filter' parameter that can be 'all', 'open', or 'closed', defaulting to 'open'.
export const listBoardsSchema = z.object({ filter: z.enum(['all', 'open', 'closed']).optional().default('open') }); - src/tools/boards.ts:13-36 (registration)Tool definition object for 'list_boards'. Contains name, description, and input schema (JSON Schema format) specifying the 'filter' parameter with enum values 'all', 'open', 'closed' and default 'open'.
export const listBoardsTool: Tool = { name: 'list_boards', description: 'List all Trello boards accessible to the user. Use this to see all boards you have access to, or filter by status.', 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)' }, filter: { type: 'string', enum: ['all', 'open', 'closed'], description: 'Filter boards by status: "open" for active boards, "closed" for archived boards, "all" for both', default: 'open' } }, required: [] } }; - src/server.ts:275-384 (registration)Server-side case handler that routes the 'list_boards' tool name to handleListBoards(args) in the CallToolRequestSchema handler.
case 'list_boards': return await handleListBoards(args); case 'get_lists': return await handleGetLists(args); // Member management case 'trello_get_member': return await handleTrelloGetMember(args); // Phase 3: Advanced features case 'trello_get_board_cards': return await handleTrelloGetBoardCards(args); case 'trello_get_card_actions': return await handleTrelloGetCardActions(args); case 'trello_get_card_attachments': return await handleTrelloGetCardAttachments(args); case 'trello_get_card_checklists': return await handleTrelloGetCardChecklists(args); case 'trello_get_board_members': return await handleTrelloGetBoardMembers(args); case 'trello_get_board_labels': return await handleTrelloGetBoardLabels(args); case 'trello_create_label': return await handleTrelloCreateLabel(args); case 'trello_update_label': return await handleTrelloUpdateLabel(args); case 'trello_add_label_to_card': return await handleTrelloAddLabelToCard(args); case 'trello_remove_label_from_card': return await handleTrelloRemoveLabelFromCard(args); case 'trello_delete_label': return await handleTrelloDeleteLabel(args); // Member management on cards case 'trello_add_member_to_card': return await handleTrelloAddMemberToCard(args); case 'trello_remove_member_from_card': return await handleTrelloRemoveMemberFromCard(args); // Custom fields case 'trello_get_board_custom_fields': return await handleTrelloGetBoardCustomFields(args); // Card archiving case 'trello_archive_card': return await handleArchiveCard(args); // List filtering case 'trello_filter_lists': return await handleTrelloFilterLists(args); // Checklist management case 'trello_create_checklist': return await handleTrelloCreateChecklist(args); case 'trello_get_checklist': return await handleTrelloGetChecklist(args); case 'trello_update_checklist': return await handleTrelloUpdateChecklist(args); case 'trello_delete_checklist': return await handleTrelloDeleteChecklist(args); case 'trello_get_checklist_field': return await handleTrelloGetChecklistField(args); case 'trello_update_checklist_field': return await handleTrelloUpdateChecklistField(args); case 'trello_get_board_for_checklist': return await handleTrelloGetBoardForChecklist(args); case 'trello_get_card_for_checklist': return await handleTrelloGetCardForChecklist(args); case 'trello_get_check_items': return await handleTrelloGetCheckItems(args); case 'trello_create_check_item': return await handleTrelloCreateCheckItem(args); case 'trello_get_check_item': return await handleTrelloGetCheckItem(args); case 'trello_delete_check_item': return await handleTrelloDeleteCheckItem(args); case 'trello_update_check_item': return await handleTrelloUpdateCheckItem(args); default: throw new Error(`Unknown tool: ${name}`); } }); return server; } - src/utils/validation.ts:55-113 (helper)Helper wrapper function that parses data using the listBoardsSchema.
}); export const getBoardSchema = z.object({ boardId: trelloIdSchema, includeDetails: z.boolean().optional().default(false), descriptionMaxLength: z.number().min(0).max(10000).optional(), compact: z.boolean().optional() }); export const getBoardListsSchema = z.object({ boardId: trelloIdSchema, filter: z.enum(['all', 'open', 'closed']).optional().default('open') }); export const createCardSchema = z.object({ name: z.string().min(1, 'Card name is required').max(16384, 'Card name too long'), desc: z.string().max(16384, 'Description too long').optional(), idList: trelloIdSchema, pos: z.union([z.number().min(0), z.string().regex(/^\d+(\.\d+)?$/).transform(Number), z.enum(['top', 'bottom'])]).optional(), due: z.string().datetime().optional(), start: z.string().datetime().optional(), idMembers: z.array(trelloIdSchema).optional(), idLabels: z.array(trelloIdSchema).optional() }); export const updateCardSchema = z.object({ cardId: trelloIdSchema, name: z.string().min(1).max(16384).optional(), desc: z.string().max(16384).optional(), closed: z.boolean().optional(), due: z.string().datetime().nullable().optional(), dueComplete: z.boolean().optional(), start: z.string().datetime().nullable().optional(), idList: trelloIdOptionalSchema, pos: z.union([z.number().min(0), z.string().regex(/^\d+(\.\d+)?$/).transform(Number), z.enum(['top', 'bottom'])]).optional(), idMembers: z.array(trelloIdSchema).optional(), idLabels: z.array(trelloIdSchema).optional() }); export const moveCardSchema = z.object({ cardId: trelloIdSchema, idList: trelloIdSchema, pos: z.union([z.number().min(0), z.string().regex(/^\d+(\.\d+)?$/).transform(Number), z.enum(['top', 'bottom'])]).optional() }); export const getCardSchema = z.object({ cardId: trelloIdSchema, includeDetails: z.boolean().optional().default(false) }); export const deleteCardSchema = z.object({ cardId: trelloIdSchema }); export function validateCredentials(data: unknown) { return credentialsSchema.parse(data); } export function validateListBoards(data: unknown) {