Skip to main content
Glama
talhaorak

Taiga MCP Bridge

by talhaorak

assign_epic_to_user

Assigns a specific epic to a user in Taiga project management, enabling streamlined task delegation and clear responsibility allocation for project workflows.

Instructions

Assigns a specific epic to a specific user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
epic_idYes
session_idYes
user_idYes

Implementation Reference

  • The handler function for the 'assign_epic_to_user' tool. It delegates the assignment by calling update_epic with assigned_to=user_id.
    @mcp.tool("assign_epic_to_user", description="Assigns a specific epic to a specific user.")
    def assign_epic_to_user(session_id: str, epic_id: int, user_id: int) -> Dict[str, Any]:
        """Assigns an epic to a user."""
        logger.info(
            f"Executing assign_epic_to_user: Epic {epic_id} -> User {user_id}, session {session_id[:8]}...")
        # Delegate to update_epic
        return update_epic(session_id, epic_id, assigned_to=user_id)
  • Helper function update_epic that performs the core logic of updating an epic via the Taiga API (api.epics.edit), used by assign_epic_to_user.
    @mcp.tool("update_epic", description="Updates details of an existing epic.")
    def update_epic(session_id: str, epic_id: int, **kwargs) -> Dict[str, Any]:
        """Updates an epic. Pass fields to update as keyword arguments (e.g., subject, description, status_id, assigned_to, color)."""
        logger.info(
            f"Executing update_epic ID {epic_id} for session {session_id[:8]} with data: {kwargs}")
        taiga_client_wrapper = _get_authenticated_client(session_id) # Use wrapper variable name
        try:
            # Use pytaigaclient edit pattern for partial updates
            if not kwargs:
                 logger.info(f"No fields provided for update on epic {epic_id}")
                 return taiga_client_wrapper.api.epics.get(epic_id)
    
            # Get current epic data to retrieve version
            current_epic = taiga_client_wrapper.api.epics.get(epic_id)
            version = current_epic.get('version')
            if not version:
                raise ValueError(f"Could not determine version for epic {epic_id}")
                
            # Use edit method for partial updates with keyword arguments
            updated_epic = taiga_client_wrapper.api.epics.edit(
                epic_id=epic_id,
                version=version,
                **kwargs
            )
            logger.info(f"Epic {epic_id} update request sent.")
            return updated_epic
        except TaigaException as e:
            logger.error(
                f"Taiga API error updating epic {epic_id}: {e}", exc_info=False)
            raise e
        except Exception as e:
            logger.error(
                f"Unexpected error updating epic {epic_id}: {e}", exc_info=True)
            raise RuntimeError(f"Server error updating epic: {e}")
  • Helper function to retrieve and validate the authenticated Taiga client wrapper from the session store.
    def _get_authenticated_client(session_id: str) -> TaigaClientWrapper:
        """
        Retrieves the authenticated TaigaClientWrapper for a given session ID.
        Raises PermissionError if the session is invalid or not found.
        """
        client = active_sessions.get(session_id)
        # Also check if the client object itself exists and is authenticated
        if not client or not client.is_authenticated:
            logger.warning(f"Invalid or expired session ID provided: {session_id}")
            # Raise PermissionError - FastMCP will map this to an appropriate error response
            raise PermissionError(
                f"Invalid or expired session ID: '{session_id}'. Please login again.")
        logger.debug(f"Retrieved valid client for session ID: {session_id}")
        return client

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/talhaorak/pytaiga-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server