get-tickets-by-list
Retrieve Trello tickets from a specific list by providing the list ID and optional limit. Simplify project management tasks by accessing targeted card data directly.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of cards to return | |
| listId | Yes | ID of the list to get tickets from |
Implementation Reference
- src/tools/cards.ts:365-404 (handler)The handler function fetches cards (referred to as tickets) from a Trello list using the lists/{id}/cards API endpoint, handles credentials check, constructs the URL with optional limit, fetches and returns JSON data, or error response.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 for 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)The tool registration call using McpServer.tool(), specifying the name 'get-tickets-by-list', input schema, and inline handler function.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, }; } } );