Skip to main content
Glama
talhaorak

Taiga MCP Bridge

by talhaorak

unassign_task_from_user

Remove user assignments from specific tasks in the Taiga project management platform. Facilitates task management by clearing assigned users when needed.

Instructions

Unassigns a specific task (sets assigned user to null).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes
task_idYes

Implementation Reference

  • The primary handler function for the 'unassign_task_from_user' MCP tool. It delegates to the general 'update_task' function by passing assigned_to=None to unassign the task from any user.
    @mcp.tool("unassign_task_from_user", description="Unassigns a specific task (sets assigned user to null).")
    def unassign_task_from_user(session_id: str, task_id: int) -> Dict[str, Any]:
        """Unassigns a task."""
        logger.info(
            f"Executing unassign_task_from_user: Task {task_id}, session {session_id[:8]}...")
        # Delegate to update_task
        return update_task(session_id, task_id, assigned_to=None)
  • Supporting helper function 'update_task' that performs the actual Taiga API edit call on tasks. This is invoked by 'unassign_task_from_user' to set the assigned_to field to None.
    def update_task(session_id: str, task_id: int, **kwargs) -> Dict[str, Any]:
        """Updates a task. Pass fields to update as keyword arguments (e.g., subject, description, status_id, assigned_to)."""
        logger.info(
            f"Executing update_task ID {task_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 task {task_id}")
                 return taiga_client_wrapper.api.tasks.get(task_id)
    
            # Get current task data to retrieve version
            current_task = taiga_client_wrapper.api.tasks.get(task_id)
            version = current_task.get('version')
            if not version:
                raise ValueError(f"Could not determine version for task {task_id}")
                
            # Use edit method for partial updates with keyword arguments
            updated_task = taiga_client_wrapper.api.tasks.edit(
                task_id=task_id,
                version=version,
                **kwargs
            )
            logger.info(f"Task {task_id} update request sent.")
            return updated_task
        except TaigaException as e:
            logger.error(
                f"Taiga API error updating task {task_id}: {e}", exc_info=False)
            raise e
        except Exception as e:
            logger.error(
                f"Unexpected error updating task {task_id}: {e}", exc_info=True)
            raise RuntimeError(f"Server error updating task: {e}")
  • Helper function to retrieve and validate the authenticated Taiga client wrapper for the given session_id, used by all authenticated tools including update_task.
    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