Skip to main content
Glama

assign_user_story_to_user

Assign a specific user story to a designated user in Taiga project management, streamlining task allocation and enhancing project coordination.

Instructions

Assigns a specific user story to a specific user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes
user_idYes
user_story_idYes

Implementation Reference

  • The primary handler function for the 'assign_user_story_to_user' MCP tool. It registers the tool via @mcp.tool decorator and implements the logic by logging the action and delegating to the update_user_story helper function to perform the assignment.
    @mcp.tool("assign_user_story_to_user", description="Assigns a specific user story to a specific user.") def assign_user_story_to_user(session_id: str, user_story_id: int, user_id: int) -> Dict[str, Any]: """Assigns a user story to a user.""" logger.info( f"Executing assign_user_story_to_user: US {user_story_id} -> User {user_id}, session {session_id[:8]}...") # Delegate to update_user_story, assuming 'assigned_to' key works return update_user_story(session_id, user_story_id, assigned_to=user_id)
  • Supporting helper function used by assign_user_story_to_user. Performs the actual Taiga API update on the user story, fetching the current version for optimistic concurrency and calling api.user_stories.edit with assigned_to=user_id to assign the story.
    @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 Taiga client wrapper from the session store, used indirectly via update_user_story.
    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