create_card
Add new tasks to Trello lists by specifying card name, description, due dates, members, labels, and position within boards.
Instructions
Creates a new card in a given list.
Args:
list_id (str): The ID of the list to create the card in.
name (str): The name of the new card.
desc (str, optional): The description of the new card. Defaults to None.
Returns:
TrelloCard: The newly created card object.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| payload | Yes |
Implementation Reference
- server/tools/card.py:63-83 (handler)The MCP tool handler function that processes the create_card tool call, validates input via CreateCardPayload, and delegates to CardService.async def create_card(ctx: Context, payload: CreateCardPayload) -> TrelloCard: """Creates a new card in a given list. Args: list_id (str): The ID of the list to create the card in. name (str): The name of the new card. desc (str, optional): The description of the new card. Defaults to None. Returns: TrelloCard: The newly created card object. """ try: logger.info(f"Creating card in list {payload.idList} with name: {payload.name}") result = await service.create_card(**payload.model_dump(exclude_unset=True)) logger.info(f"Successfully created card in list: {payload.idList}") return result except Exception as e: error_msg = f"Failed to create card: {str(e)}" logger.error(error_msg) await ctx.error(error_msg) raise
- server/dtos/create_card.py:4-35 (schema)Pydantic BaseModel defining the input schema/payload for the create_card tool.class CreateCardPayload(BaseModel): """ Payload for creating 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 desc: str | None = None closed: bool | None = None idMembers: str | None = None idList: str 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
- server/tools/tools.py:26-26 (registration)Registration of the create_card tool handler with the MCP server.mcp.add_tool(card.create_card)
- server/services/card.py:43-56 (helper)CardService method that makes the actual Trello API POST request to create a card.async def create_card(self, **kwargs) -> TrelloCard: """Creates a new card in a given list. Args list_id (str): The ID of the list to create the card in. name (str): The name of the new card. desc (str, optional): The description of the new card. Defaults to None. Returns: TrelloCard: The newly created card object. """ response = await self.client.POST("/cards", data=kwargs) return TrelloCard(**response)