get_board_labels
Retrieve all labels from a specific Trello board to organize and categorize cards effectively. Provide the board ID to access label information.
Instructions
Retrieves all labels for a specific board.
Args:
board_id (str): The ID of the board whose labels to retrieve.
Returns:
List[TrelloLabel]: A list of label objects for the board.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| board_id | Yes |
Implementation Reference
- server/tools/board.py:59-77 (handler)The MCP tool handler function for get_board_labels. It handles the context, logs the operation, delegates to BoardService.get_board_labels(board_id), and returns the list of labels or raises errors.async def get_board_labels(ctx: Context, board_id: str) -> List[TrelloLabel]: """Retrieves all labels for a specific board. Args: board_id (str): The ID of the board whose labels to retrieve. Returns: List[TrelloLabel]: A list of label objects for the board. """ try: logger.info(f"Getting labels for board: {board_id}") result = await service.get_board_labels(board_id) logger.info(f"Successfully retrieved {len(result)} 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
- server/tools/tools.py:13-13 (registration)Registers the get_board_labels tool with the MCP server by adding it to the tools list.mcp.add_tool(board.get_board_labels)
- server/services/board.py:43-53 (helper)The supporting service method in BoardService that performs the actual Trello API call to fetch labels and deserializes them into TrelloLabel models.async def get_board_labels(self, board_id: str) -> List[TrelloLabel]: """Retrieves all labels for a specific board. Args: board_id (str): The ID of the board whose labels to retrieve. Returns: List[TrelloLabel]: A list of label objects for the board. """ response = await self.client.GET(f"/boards/{board_id}/labels") return [TrelloLabel(**label) for label in response]