Skip to main content
Glama

get-list-cards

Retrieve cards from a specific Trello list using the list ID, with options to include specific card fields and apply filters like 'open', 'closed', or 'all'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldsNoComma-separated list of card fields to include
filterNoFilter for card types (e.g., "open", "closed", "all")
listIdYesID of the list to get cards from

Implementation Reference

  • The handler function for the 'get-list-cards' tool. It takes listId (required), fields and filter (optional), checks for API credentials, constructs the Trello API URL for /lists/{listId}/cards, appends query params, fetches the data, and returns JSON stringified response or error.
    async ({ listId, fields, filter }) => { 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 (fields) url.searchParams.append('fields', fields); if (filter) url.searchParams.append('filter', filter); 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 list cards: ${error}`, }, ], isError: true, }; } }
  • Zod schema defining the input parameters for the 'get-list-cards' tool: listId (string), optional fields (string), optional filter (string).
    listId: z.string().describe('ID of the list to get cards from'), fields: z.string().optional().describe('Comma-separated list of card fields to include'), filter: z.string().optional().describe('Filter for card types (e.g., "open", "closed", "all")'), },
  • Registration of the 'get-list-cards' tool using server.tool(), including inline schema and handler function.
    // GET /lists/{id}/cards - Get cards from a list server.tool( 'get-list-cards', { listId: z.string().describe('ID of the list to get cards from'), fields: z.string().optional().describe('Comma-separated list of card fields to include'), filter: z.string().optional().describe('Filter for card types (e.g., "open", "closed", "all")'), }, async ({ listId, fields, filter }) => { 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 (fields) url.searchParams.append('fields', fields); if (filter) url.searchParams.append('filter', filter); 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 list cards: ${error}`, }, ], isError: true, }; } } );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/adriangrahldev/advanced-trello-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server