unassign_epic_from_user
Remove user assignment from a specific epic in Taiga by setting the assigned user to null, ensuring epics are managed accurately within the project management platform.
Instructions
Unassigns a specific epic (sets assigned user to null).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| epic_id | Yes | ||
| session_id | Yes |
Implementation Reference
- src/server.py:989-996 (handler)The main handler function for the 'unassign_epic_from_user' tool, registered via the @mcp.tool decorator. It authenticates the session, logs the action, and delegates to the update_epic helper by passing assigned_to=None to unassign the epic.@mcp.tool("unassign_epic_from_user", description="Unassigns a specific epic (sets assigned user to null).") def unassign_epic_from_user(session_id: str, epic_id: int) -> Dict[str, Any]: """Unassigns an epic.""" logger.info( f"Executing unassign_epic_from_user: Epic {epic_id}, session {session_id[:8]}...") # Delegate to update_epic return update_epic(session_id, epic_id, assigned_to=None)
- src/server.py:923-957 (helper)Supporting helper function 'update_epic' that performs the core logic of updating an epic via the Taiga API (api.epics.edit), including version handling and error management. Called by unassign_epic_from_user with assigned_to=None.@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}")
- src/server.py:39-52 (helper)Helper function to retrieve and validate the authenticated TaigaClientWrapper from the session store, used by all authenticated tools including unassign_epic_from_user.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
- src/taiga_client.py:15-29 (helper)The TaigaClientWrapper class provides the API client instance (self.api.epics.edit is ultimately called) and authentication management used by the tools.class TaigaClientWrapper: """ A wrapper around the pytaiga-client library to manage API instance and authentication state. """ def __init__(self, host: str): if not host: raise ValueError("Taiga host URL cannot be empty.") # Store host, but initialize client later during login/token auth self.host = host # Use the new client type self.api: Optional[TaigaClient] = None logger.info(f"TaigaClientWrapper initialized for host: {self.host}")