get-list-cards
Retrieve cards from a specific Trello list with options to filter by status and select fields for efficient project tracking and management.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| listId | Yes | ID of the list to get cards from | |
| fields | No | Comma-separated list of card fields to include | |
| filter | No | Filter for card types (e.g., "open", "closed", "all") |
Implementation Reference
- src/tools/lists.ts:379-428 (registration)Registration of the 'get-list-cards' tool using server.tool, including input schema (listId, optional fields and filter) and the handler function that constructs the Trello API URL for /lists/{listId}/cards and fetches the cards.server.tool( 'get-list-cards', { listId: z.string().describe('ID of the list to get cards from'), fields: z.string().optional().describe('Comma-separated list of card fields to include'), filter: z.string().optional().describe('Filter for card types (e.g., "open", "closed", "all")'), }, async ({ listId, fields, filter }) => { try { if (!credentials.apiKey || !credentials.apiToken) { return { content: [ { type: 'text', text: 'Trello API credentials are not configured', }, ], isError: true, }; } const url = new URL(`https://api.trello.com/1/lists/${listId}/cards`); url.searchParams.append('key', credentials.apiKey); url.searchParams.append('token', credentials.apiToken); if (fields) url.searchParams.append('fields', fields); if (filter) url.searchParams.append('filter', filter); const response = await fetch(url.toString()); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error getting list cards: ${error}`, }, ], isError: true, }; } } );
- src/index.ts:89-89 (registration)Top-level call to registerListsTools, which includes the registration of 'get-list-cards'.registerListsTools(server, credentials);
- src/tools/cards.ts:358-406 (handler)An alias implementation named 'get-tickets-by-list' in cards.ts that performs the same logic as 'get-list-cards'.// GET /lists/{id}/cards - Get tickets by list (alias for get-list-cards) server.tool( 'get-tickets-by-list', { listId: z.string().describe('ID of the list to get tickets from'), limit: z.number().optional().describe('Maximum number of cards to return'), }, async ({ listId, limit }) => { try { if (!credentials.apiKey || !credentials.apiToken) { return { content: [ { type: 'text', text: 'Trello API credentials are not configured', }, ], isError: true, }; } const url = new URL(`https://api.trello.com/1/lists/${listId}/cards`); url.searchParams.append('key', credentials.apiKey); url.searchParams.append('token', credentials.apiToken); if (limit) url.searchParams.append('limit', limit.toString()); const response = await fetch(url.toString()); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error getting tickets by list: ${error}`, }, ], isError: true, }; } } );