list_all_projects
Retrieve all projects visible to the user on Taiga platform using session ID. Admin privileges grant access to the full project list.
Instructions
Lists all projects visible to the user (requires admin privileges for full list). Uses the provided session_id.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes |
Implementation Reference
- src/server.py:132-138 (handler)The handler function for the 'list_all_projects' tool. It logs the execution and delegates the actual project listing to the 'list_projects' tool after implicit session authentication.@mcp.tool("list_all_projects", description="Lists all projects visible to the user (requires admin privileges for full list). Uses the provided session_id.") def list_all_projects(session_id: str) -> List[Dict[str, Any]]: """Lists all projects visible to the authenticated user (scope depends on permissions).""" logger.info(f"Executing list_all_projects for session {session_id[:8]}...") # pytaigaclient's list() likely behaves similarly to python-taiga's return list_projects(session_id) # Keep delegation
- src/server.py:111-129 (helper)Supporting 'list_projects' tool that performs the actual API call to retrieve projects using the authenticated Taiga client. Delegated to by 'list_all_projects'.@mcp.tool("list_projects", description="Lists projects accessible to the user associated with the provided session_id.") def list_projects(session_id: str) -> List[Dict[str, Any]]: """Lists projects accessible by the authenticated user.""" logger.info(f"Executing list_projects for session {session_id[:8]}...") taiga_client_wrapper = _get_authenticated_client(session_id) # Use wrapper variable name try: # Use pytaigaclient syntax: client.resource.method() projects = taiga_client_wrapper.api.projects.list() # Remove .to_dict() as pytaigaclient should return dicts # result = [p.to_dict() for p in projects] logger.info( f"list_projects successful for session {session_id[:8]}, found {len(projects)} projects.") return projects # Return directly except TaigaException as e: logger.error(f"Taiga API error listing projects: {e}", exc_info=False) raise e except Exception as e: logger.error(f"Unexpected error listing projects: {e}", exc_info=True) raise RuntimeError(f"Server error listing projects: {e}")
- src/server.py:39-52 (helper)Helper function used by project listing tools to retrieve and validate the TaigaClientWrapper instance 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