delete_user_story
Remove a user story by its ID from the Taiga project management platform using a session token to authenticate the deletion process.
Instructions
Deletes a user story by its ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | ||
| user_story_id | Yes |
Implementation Reference
- src/server.py:385-403 (handler)The main handler function for the 'delete_user_story' MCP tool. It authenticates the session, calls the Taiga API to delete the user story by ID, logs the action, and returns a success status or raises appropriate errors.@mcp.tool("delete_user_story", description="Deletes a user story by its ID.") def delete_user_story(session_id: str, user_story_id: int) -> Dict[str, Any]: """Deletes a user story by ID.""" logger.warning( f"Executing delete_user_story ID {user_story_id} for session {session_id[:8]}...") taiga_client_wrapper = _get_authenticated_client(session_id) # Use wrapper variable name try: # Use pytaigaclient syntax: client.resource.delete(id=...) taiga_client_wrapper.api.user_stories.delete(id=user_story_id) logger.info(f"User story {user_story_id} deleted successfully.") return {"status": "deleted", "user_story_id": user_story_id} except TaigaException as e: logger.error( f"Taiga API error deleting user story {user_story_id}: {e}", exc_info=False) raise e except Exception as e: logger.error( f"Unexpected error deleting user story {user_story_id}: {e}", exc_info=True) raise RuntimeError(f"Server error deleting user story: {e}")
- src/server.py:39-52 (helper)Helper function used by delete_user_story (and other tools) to retrieve and validate the authenticated Taiga client for the given session ID.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:385-385 (registration)The @mcp.tool decorator registers the delete_user_story function as an MCP tool with the specified name and description.@mcp.tool("delete_user_story", description="Deletes a user story by its ID.")