get_user_story
Retrieve detailed information about a specific user story by its ID using the Taiga MCP Bridge, enabling efficient project management and collaboration with AI systems.
Instructions
Gets detailed information about a specific 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:321-339 (handler)The primary handler function for the MCP tool 'get_user_story'. It authenticates the session, fetches the user story by ID using the Taiga API client, and returns the details. Includes the @mcp.tool decorator for registration.@mcp.tool("get_user_story", description="Gets detailed information about a specific user story by its ID.") def get_user_story(session_id: str, user_story_id: int) -> Dict[str, Any]: """Retrieves user story details by ID.""" logger.info( f"Executing get_user_story ID {user_story_id} for session {session_id[:8]}...") taiga_client_wrapper = _get_authenticated_client(session_id) # Use wrapper variable name try: # User stories expects user_story_id as a positional argument story = taiga_client_wrapper.api.user_stories.get(user_story_id) # return story.to_dict() # Remove .to_dict() return story # Return directly except TaigaException as e: logger.error( f"Taiga API error getting user story {user_story_id}: {e}", exc_info=False) raise e except Exception as e: logger.error( f"Unexpected error getting user story {user_story_id}: {e}", exc_info=True) raise RuntimeError(f"Server error getting user story: {e}")
- src/server.py:39-52 (helper)Helper function used by get_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/taiga_client.py:15-29 (helper)The TaigaClientWrapper class imported and used in get_user_story handler. It wraps pytaigaclient.TaigaClient and handles login/authentication, providing the .api.user_stories.get() method.class TaigaClientWrapper: """ A wrapper around the pytaiga-client library to manage API instance and authentication state. """ def __init__(self, host: str): if not host: raise ValueError("Taiga host URL cannot be empty.") # Store host, but initialize client later during login/token auth self.host = host # Use the new client type self.api: Optional[TaigaClient] = None logger.info(f"TaigaClientWrapper initialized for host: {self.host}")