list_projects
Retrieve all accessible projects from Coroot observability platform to view project IDs and names for authenticated users.
Instructions
List all accessible projects.
Returns a list of all projects that the authenticated user has access to. Each project includes its ID and name.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp_coroot/server.py:152-159 (handler)Main MCP tool handler for 'list_projects'. Decorated with @mcp.tool() for registration and executes the tool logic by calling the impl helper.@mcp.tool() async def list_projects() -> dict[str, Any]: """List all accessible projects. Returns a list of all projects that the authenticated user has access to. Each project includes its ID and name. """ return await list_projects_impl() # type: ignore[no-any-return]
- src/mcp_coroot/server.py:141-149 (helper)Helper implementation that fetches projects via CorootClient and formats the success response with count and projects list.@handle_errors async def list_projects_impl() -> dict[str, Any]: """List all accessible projects.""" projects = await get_client().list_projects() return { "success": True, "count": len(projects), "projects": projects, }
- src/mcp_coroot/client.py:290-300 (helper)CorootClient method that implements the actual API call to retrieve projects from the /api/user endpoint.async def list_projects(self) -> list[dict[str, Any]]: """List all accessible projects. Returns: List of project dictionaries. """ # Get user info which includes projects list user_response = await self._request("GET", "/api/user") user_data: dict[str, Any] = user_response.json() projects: list[dict[str, Any]] = user_data.get("projects", []) return projects
- src/mcp_coroot/server.py:93-113 (helper)Lazy client factory used by tool helpers to get the shared CorootClient instance.def get_client() -> CorootClient: """Get or create the client instance. Raises: ValueError: If no credentials are configured. """ global _client if _client is None: try: _client = CorootClient() except ValueError as e: # Re-raise with more context raise ValueError( "Coroot credentials not configured. " "Please set COROOT_BASE_URL and either:\n" " - COROOT_USERNAME and COROOT_PASSWORD for automatic login\n" " - COROOT_SESSION_COOKIE for direct authentication\n" " - COROOT_API_KEY for data ingestion endpoints" ) from e return _client