get-tickets-by-list
Retrieve Trello cards from a specific list by providing the list ID, with optional limit control for batch operations.
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)Handler function that retrieves cards (tickets) from a specified Trello list using the Trello API, with optional limit parameter.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)Input schema using Zod: listId (required string, ID of the list), 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)Tool registration call using server.tool(), specifying 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 (!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, }; } } );