Skip to main content
Glama
m0xai

Trello MCP Server with Python

by m0xai

get_cards

Retrieve all cards from a specific Trello list using the list ID to view and manage card details.

Instructions

Retrieves all cards in a given list.

Args:
    list_id (str): The ID of the list whose cards to retrieve.

Returns:
    List[TrelloCard]: A list of card objects.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
list_idYes

Implementation Reference

  • MCP tool handler for 'get_cards': retrieves cards from a Trello list using CardService, logs actions, handles errors with ctx.error.
    async def get_cards(ctx: Context, list_id: str) -> List[TrelloCard]:
        """Retrieves all cards in a given list.
    
        Args:
            list_id (str): The ID of the list whose cards to retrieve.
    
        Returns:
            List[TrelloCard]: A list of card objects.
        """
        try:
            logger.info(f"Getting cards for list: {list_id}")
            result = await service.get_cards(list_id)
            logger.info(f"Successfully retrieved {len(result)} cards for list: {list_id}")
            return result
        except Exception as e:
            error_msg = f"Failed to get cards: {str(e)}"
            logger.error(error_msg)
            await ctx.error(error_msg)
            raise
  • Registration of the 'get_cards' tool with the MCP server via mcp.add_tool.
    mcp.add_tool(card.get_cards)
  • CardService method that implements the core logic by calling Trello API to fetch cards from a list.
    async def get_cards(self, list_id: str) -> List[TrelloCard]:
        """Retrieves all cards in a given list.
    
        Args:
            list_id (str): The ID of the list whose cards to retrieve.
    
        Returns:
            List[TrelloCard]: A list of card objects.
        """
        response = await self.client.GET(f"/lists/{list_id}/cards")
        return [TrelloCard(**card) for card in response]

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/m0xai/trello-mcp-server'

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