Skip to main content
Glama
m0xai

Trello MCP Server with Python

by m0xai

update_card

Modify Trello card details like name, description, due dates, members, labels, and status to keep project tasks current.

Instructions

Updates a card's attributes.

Args: card_id (str): The ID of the card to update. **kwargs: Keyword arguments representing the attributes to update on the card. Returns: TrelloCard: The updated card object.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
card_idYes
payloadYes

Implementation Reference

  • The MCP tool handler function that executes the update_card tool logic. It logs the action, calls the CardService to update the card via Trello API, handles errors, and returns the updated TrelloCard.
    async def update_card( ctx: Context, card_id: str, payload: UpdateCardPayload ) -> TrelloCard: """Updates a card's attributes. Args: card_id (str): The ID of the card to update. **kwargs: Keyword arguments representing the attributes to update on the card. Returns: TrelloCard: The updated card object. """ try: logger.info(f"Updating card: {card_id} with payload: {payload}") result = await service.update_card( card_id, **payload.model_dump(exclude_unset=True) ) logger.info(f"Successfully updated card: {card_id}") return result except Exception as e: error_msg = f"Failed to update card: {str(e)}" logger.error(error_msg) await ctx.error(error_msg) raise
  • Pydantic BaseModel defining the optional fields for the update_card tool input payload.
    class UpdateCardPayload(BaseModel): """ Payload for updating a card. Attributes: name (str): The name of the card. desc (str): The description of the card. closed (bool): Whether the card is closed or not. idMembers (str): Comma-separated list of member IDs for the card. idList (str): The ID of the list the card is in. idLabels (str): Comma-separated list of label IDs for the card. idBoard (str): The ID of the board the card is in. pos (str | int): The position of the card. due (str): The due date of the card in ISO 8601 format. start (str): The start date of the card in ISO 8601 format. dueComplete (bool): Whether the card is due complete or not. subscribed (bool): Whether the card is subscribed or not. """ name: str | None = None desc: str | None = None closed: bool | None = None idMembers: str | None = None idList: str | None = None idLabels: str | None = None idBoard: str | None = None pos: str | None = None due: str | None = None start: str | None = None dueComplete: bool | None = None subscribed: bool | None = None
  • Registration of the update_card tool with the MCP server in the register_tools function.
    mcp.add_tool(card.update_card)
  • CardService method that performs the actual Trello API PUT request to update the card, called by the tool handler.
    async def update_card(self, card_id: str, **kwargs) -> TrelloCard: """Updates a card's attributes. Args: card_id (str): The ID of the card to update. **kwargs: Keyword arguments representing the attributes to update on the card. Returns: TrelloCard: The updated card object. """ response = await self.client.PUT(f"/cards/{card_id}", data=kwargs) return TrelloCard(**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