get_cards_by_list_id
Retrieve all cards from a specified Trello list by providing the list ID. Simplify card management and integration with Trello boards using structured data.
Instructions
Fetch cards from a specific Trello list
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| listId | Yes | ID of the Trello list |
Implementation Reference
- src/index.ts:227-233 (handler)MCP server tool handler for 'get_cards_by_list_id': validates arguments using validateGetCardsListRequest, calls TrelloClient.getCardsByList, and returns JSON stringified cards.case 'get_cards_by_list_id': { const validArgs = validateGetCardsListRequest(args); const cards = await this.trelloClient.getCardsByList(validArgs.listId); return { content: [{ type: 'text', text: JSON.stringify(cards, null, 2) }], }; }
- src/validators.ts:39-46 (schema)Input schema validation function specifically for the get_cards_by_list_id tool, ensuring listId is a non-empty string.export function validateGetCardsListRequest(args: Record<string, unknown>): { listId: string } { if (!args.listId) { throw new McpError(ErrorCode.InvalidParams, 'listId is required'); } return { listId: validateString(args.listId, 'listId'), }; }
- src/index.ts:62-74 (registration)Registration of the 'get_cards_by_list_id' tool in the MCP server, including name, description, and input schema definition.name: 'get_cards_by_list_id', description: 'Fetch cards from a specific Trello list', inputSchema: { type: 'object', properties: { listId: { type: 'string', description: 'ID of the Trello list', }, }, required: ['listId'], }, },
- src/trello-client.ts:74-80 (helper)TrelloClient helper method implementing the core logic: makes authenticated API request to fetch cards from the specified list ID, with rate limiting and error handling.async getCardsByList(listId: string): Promise<TrelloCard[]> { console.error(`[TrelloClient] Getting cards for list: ${listId}`); return this.handleRequest(async () => { const response = await this.axiosInstance.get(`/lists/${listId}/cards`); return response.data; }); }