get-tickets-by-list
Retrieve Trello cards from a specific list by providing the list ID, with optional limit control for batch processing.
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/index.ts:648-703 (handler)The handler function fetches cards (tickets) from a Trello list using the Trello API. It checks for API credentials, constructs the API URL with listId and optional limit, fetches the data, and returns the JSON stringified response or error.async ({ listId, limit }) => { try { if (!trelloApiKey || !trelloApiToken) { 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', trelloApiKey); url.searchParams.append('token', trelloApiToken); if (limit) { url.searchParams.append('limit', limit.toString()); } const response = await fetch(url.toString()); const data = await response.json(); if (!Array.isArray(data)) { return { content: [ { type: 'text', text: 'Failed to get tickets from list', }, ], isError: true, }; } return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error getting tickets from list: ${error}`, }, ], isError: true, }; } }
- src/index.ts:644-647 (schema)Zod schema defining input parameters: listId (required string, ID of the Trello list) and limit (optional number, max cards to return).{ listId: z.string().describe('ID of the list to get tickets from'), limit: z.number().optional().describe('Maximum number of cards to return'), },
- src/index.ts:642-704 (registration)MCP server tool registration call: server.tool('get-tickets-by-list', inputSchema, handlerFunction).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 (!trelloApiKey || !trelloApiToken) { 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', trelloApiKey); url.searchParams.append('token', trelloApiToken); if (limit) { url.searchParams.append('limit', limit.toString()); } const response = await fetch(url.toString()); const data = await response.json(); if (!Array.isArray(data)) { return { content: [ { type: 'text', text: 'Failed to get tickets from list', }, ], isError: true, }; } return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error getting tickets from list: ${error}`, }, ], isError: true, }; } } );