Skip to main content
Glama
talhaorak

Taiga MCP Bridge

by talhaorak

unassign_user_story_from_user

Remove user assignment from a specific user story in Taiga by setting the assigned user to null, simplifying task management and reallocation.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes
user_story_idYes

Implementation Reference

  • The handler function for the 'unassign_user_story_from_user' MCP tool. It delegates the unassignment logic to the update_user_story function by passing assigned_to=None.
    @mcp.tool("unassign_user_story_from_user", description="Unassigns a specific user story (sets assigned user to null).")
    def unassign_user_story_from_user(session_id: str, user_story_id: int) -> Dict[str, Any]:
        """Unassigns a user story."""
        logger.info(
            f"Executing unassign_user_story_from_user: US {user_story_id}, session {session_id[:8]}...")
        # Delegate to update_user_story with assigned_to=None
        return update_user_story(session_id, user_story_id, assigned_to=None)
  • The supporting update_user_story function that performs the actual API update on a user story via taiga_client_wrapper.api.user_stories.edit, fetching the current version first. This is called by the unassign_user_story_from_user handler.
    @mcp.tool("update_user_story", description="Updates details of an existing user story.")
    def update_user_story(session_id: str, user_story_id: int, **kwargs) -> Dict[str, Any]:
        """Updates a user story. Pass fields to update as keyword arguments (e.g., subject, description, status_id, assigned_to)."""
        logger.info(
            f"Executing update_user_story ID {user_story_id} for session {session_id[:8]} with data: {kwargs}")
        taiga_client_wrapper = _get_authenticated_client(session_id) # Use wrapper variable name
        try:
            # Use pytaigaclient update pattern: client.resource.edit for partial updates
            if not kwargs:
                 logger.info(f"No fields provided for update on user story {user_story_id}")
                 return taiga_client_wrapper.api.user_stories.get(user_story_id)
    
            # Get current user story data to retrieve version
            current_story = taiga_client_wrapper.api.user_stories.get(user_story_id)
            version = current_story.get('version')
            if not version:
                raise ValueError(f"Could not determine version for user story {user_story_id}")
                
            # Use edit method for partial updates with keyword arguments
            updated_story = taiga_client_wrapper.api.user_stories.edit(
                user_story_id=user_story_id,
                version=version,
                **kwargs
            )
            logger.info(f"User story {user_story_id} update request sent.")
            return updated_story
        except TaigaException as e:
            logger.error(
                f"Taiga API error updating user story {user_story_id}: {e}", exc_info=False)
            raise e
        except Exception as e:
            logger.error(
                f"Unexpected error updating user story {user_story_id}: {e}", exc_info=True)
            raise RuntimeError(f"Server error updating user story: {e}")
  • Helper function to retrieve and validate the authenticated TaigaClientWrapper from the active_sessions dictionary based on session_id. Used by all authenticated tools including unassign_user_story_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/server.py:415-415 (registration)
    The @mcp.tool decorator registers the unassign_user_story_from_user function as an MCP tool.
    @mcp.tool("unassign_user_story_from_user", description="Unassigns a specific user story (sets assigned user to null).")

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