get_application
Retrieve application details and performance metrics including CPU, memory, network data, health checks, SLOs, incidents, and deployment history from the Coroot observability platform.
Instructions
Get application details and metrics.
Retrieves comprehensive information about an application including:
Performance metrics (CPU, memory, network)
Health checks and SLOs
Recent incidents
Deployment history
Args: project_id: Project ID app_id: Application ID (format: namespace/kind/name) from_timestamp: Start timestamp for metrics (optional) to_timestamp: End timestamp for metrics (optional)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| app_id | Yes | ||
| from_timestamp | No | ||
| to_timestamp | No |
Implementation Reference
- src/mcp_coroot/server.py:239-256 (handler)Core handler implementing the tool logic: URL-encodes app_id and delegates to CorootClient.get_application to fetch application details and metrics.async def get_application_impl( project_id: str, app_id: str, from_timestamp: int | None = None, to_timestamp: int | None = None, ) -> dict[str, Any]: """Get application details and metrics.""" # URL encode the app_id since it contains slashes encoded_app_id = quote(app_id, safe="") app = await get_client().get_application( project_id, encoded_app_id, from_timestamp, to_timestamp ) return { "success": True, "application": app, }
- src/mcp_coroot/server.py:258-281 (registration)MCP tool registration via @mcp.tool() decorator. Defines the tool interface, parameters (serving as input schema), and comprehensive docstring describing usage and output.@mcp.tool() async def get_application( project_id: str, app_id: str, from_timestamp: int | None = None, to_timestamp: int | None = None, ) -> dict[str, Any]: """Get application details and metrics. Retrieves comprehensive information about an application including: - Performance metrics (CPU, memory, network) - Health checks and SLOs - Recent incidents - Deployment history Args: project_id: Project ID app_id: Application ID (format: namespace/kind/name) from_timestamp: Start timestamp for metrics (optional) to_timestamp: End timestamp for metrics (optional) """ return await get_application_impl( # type: ignore[no-any-return] project_id, app_id, from_timestamp, to_timestamp )
- src/mcp_coroot/client.py:354-385 (helper)Supporting client method in CorootClient that makes the HTTP GET request to the Coroot API to retrieve application data, handling query parameters for time range.async def get_application( self, project_id: str, app_id: str, from_timestamp: int | None = None, to_timestamp: int | None = None, ) -> dict[str, Any]: """Get application details and metrics. Args: project_id: Project ID. app_id: Application ID (format: namespace/kind/name). from_timestamp: Start timestamp for metrics. to_timestamp: End timestamp for metrics. Returns: Application metrics and information. """ params = {} if from_timestamp: params["from"] = str(from_timestamp) if to_timestamp: params["to"] = str(to_timestamp) response = await self._request( "GET", f"/api/project/{project_id}/app/{app_id}", params=params, ) data: dict[str, Any] = response.json() return data
- src/mcp_coroot/server.py:93-112 (helper)Utility function to lazily initialize and retrieve the shared CorootClient instance used by all MCP tools.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