get-tickets-by-list
Retrieve Trello cards from a specific list to track tasks and manage project workflows efficiently.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| listId | Yes | ID of the list to get tickets from | |
| limit | No | Maximum number of cards to return |
Implementation Reference
- src/tools/cards.ts:365-404 (handler)Executes the tool logic by fetching cards (tickets) from the specified Trello list using the API endpoint /lists/{id}/cards, with optional limit parameter. Handles credentials check and errors.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, }; }
- src/tools/cards.ts:361-364 (schema)Zod schema defining the input parameters: required listId (string) and optional limit (number).{ listId: z.string().describe('ID of the list to get tickets from'), limit: z.number().optional().describe('Maximum number of cards to return'), },
- src/tools/cards.ts:359-406 (registration)Registers the 'get-tickets-by-list' tool on the MCP server using server.tool(), including schema and handler.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, }; } } );
- src/index.ts:90-90 (registration)Top-level call to register all cards-related tools, including 'get-tickets-by-list', on the main MCP server instance.registerCardsTools(server, credentials);