update_user_story
Modifies existing user stories in Taiga project management platform by updating their details via the MCP Bridge. Requires session ID, user story ID, and specific parameters.
Instructions
Updates details of an existing user story.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kwargs | Yes | ||
| session_id | Yes | ||
| user_story_id | Yes |
Implementation Reference
- src/server.py:349-382 (handler)The core handler function for the 'update_user_story' MCP tool. It validates the session, fetches the current version of the user story, and performs a partial update via the Taiga API's user_stories.edit method using provided keyword arguments. Handles errors appropriately.@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}")
- src/server.py:39-52 (helper)Helper function used by update_user_story (and other tools) to retrieve and validate the TaigaClientWrapper instance for the given session_id, raising PermissionError if invalid.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:349-349 (registration)The @mcp.tool decorator registers the update_user_story function as an MCP tool with the specified name and description.@mcp.tool("update_user_story", description="Updates details of an existing user story.")