""" This module contains tools for managing Trello boards. """ import logging from typing import List from mcp.server.fastmcp import Context from pmcp.mcp_server.trello_server.models import TrelloBoard, TrelloLabel from pmcp.mcp_server.trello_server.services.board import BoardService from pmcp.mcp_server.trello_server.trello import trello_client service = BoardService(trello_client) async def get_board(ctx: Context, board_id: str) -> TrelloBoard: """Retrieves a specific board by its ID. Args: board_id (str): The ID of the board to retrieve. Returns: TrelloBoard: The board object containing board details. """ try: result = await service.get_board(board_id) return result except Exception as e: error_msg = f"Failed to get board: {str(e)}" await ctx.error(error_msg) raise async def get_boards(ctx: Context) -> List[TrelloBoard]: """Retrieves all boards for the authenticated user. Use this method when the user specify only the Board Name and you have to retrieve the Board ID. Returns: List[TrelloBoard]: A list of board objects. """ try: result = await service.get_boards() return result except Exception as e: error_msg = f"Failed to get boards: {str(e)}" await ctx.error(error_msg) raise 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: result = await service.get_board_labels(board_id) return result except Exception as e: error_msg = f"Failed to get board labels: {str(e)}" await ctx.error(error_msg) raise