list_user_stories
Retrieve user stories from a Taiga project using specified filters. Supports project management by enabling precise filtering and organization of user stories.
Instructions
Lists user stories within a specific project, optionally filtered.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filters | Yes | ||
| project_id | Yes | ||
| session_id | Yes |
Implementation Reference
- src/server.py:274-292 (handler)The handler function implementing the list_user_stories MCP tool. It retrieves user stories from a Taiga project using the authenticated client and supports optional filters.@mcp.tool("list_user_stories", description="Lists user stories within a specific project, optionally filtered.") def list_user_stories(session_id: str, project_id: int, **filters) -> List[Dict[str, Any]]: """Lists user stories for a project. Optional filters like 'milestone', 'status', 'assigned_to' can be passed as keyword arguments.""" logger.info( f"Executing list_user_stories for project {project_id}, session {session_id[:8]}, filters: {filters}") taiga_client_wrapper = _get_authenticated_client(session_id) # Use wrapper variable name try: # Use pytaigaclient syntax: client.resource.list(project=..., **filters) stories = taiga_client_wrapper.api.user_stories.list(project=project_id, **filters) # return [s.to_dict() for s in stories] # Remove .to_dict() return stories # Return directly except TaigaException as e: logger.error( f"Taiga API error listing user stories for project {project_id}: {e}", exc_info=False) raise e except Exception as e: logger.error( f"Unexpected error listing user stories for project {project_id}: {e}", exc_info=True) raise RuntimeError(f"Server error listing user stories: {e}")
- src/server.py:39-52 (helper)Helper function used by list_user_stories (and other tools) to get the authenticated Taiga client from the session store.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:274-274 (registration)The @mcp.tool decorator registers the list_user_stories function as an MCP tool.@mcp.tool("list_user_stories", description="Lists user stories within a specific project, optionally filtered.")