Skip to main content
Glama
m0xai

Trello MCP Server with Python

by m0xai

create_board_label

Add custom labels to Trello boards for organizing tasks by specifying name and color.

Instructions

Create label for a specific board.

Args: board_id (str): The ID of the board whose to add label to. name (str): The name of the label. color (str): The color of the label. Returns: TrelloLabel: A label object for the board.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
board_idYes
payloadYes

Implementation Reference

  • MCP tool handler function that creates a Trello board label using the BoardService.
    async def create_board_label(ctx: Context, board_id: str, payload: CreateLabelPayload) -> TrelloLabel: """Create label for a specific board. Args: board_id (str): The ID of the board whose to add label to. name (str): The name of the label. color (str): The color of the label. Returns: TrelloLabel: A label object for the board. """ try: logger.info(f"Creating label {payload.name} label for board: {board_id}") result = await service.create_board_label(board_id, **payload.model_dump(exclude_unset=True)) logger.info(f"Successfully created label {payload.name} labels for board: {board_id}") return result except Exception as e: error_msg = f"Failed to get board labels: {str(e)}" logger.error(error_msg) await ctx.error(error_msg) raise
  • Pydantic input schema for the create_board_label tool, defining name and optional color.
    class CreateLabelPayload(BaseModel): """ Payload for creating a label. Attributes: name (str): The name of the label. color (str): The color of the label. """ name: str color: str | None = None
  • Registration of the create_board_label tool with the MCP server.
    mcp.add_tool(board.create_board_label)
  • BoardService helper method that makes the Trello API call to create the label.
    async def create_board_label(self, board_id: str, **kwargs) -> TrelloLabel: """Create label for a specific board. Args: board_id (str): The ID of the board whose to add label. Returns: List[TrelloLabel]: A list of label objects for the board. """ response = await self.client.POST(f"/boards/{board_id}/labels", data=kwargs) return TrelloLabel(**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