get_panel_data
Retrieve metrics and time series data for a specific dashboard panel in Coroot to analyze application performance and infrastructure monitoring.
Instructions
Get data for a specific dashboard panel.
Retrieves the data that powers a specific panel in a custom dashboard, including metrics, time series data, or aggregated values.
Args: project_id: The project ID dashboard_id: The dashboard ID panel_id: The panel ID within the dashboard from_time: Optional start time (ISO format or relative like '-1h') to_time: Optional end time (ISO format or 'now')
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| dashboard_id | Yes | ||
| panel_id | Yes | ||
| from_time | No | ||
| to_time | No |
Implementation Reference
- src/mcp_coroot/server.py:1904-1927 (handler)MCP tool handler function for 'get_panel_data'. This is the entry point registered with FastMCP that handles tool calls and delegates to the implementation.@mcp.tool() async def get_panel_data( project_id: str, dashboard_id: str, panel_id: str, from_time: str | None = None, to_time: str | None = None, ) -> dict[str, Any]: """ Get data for a specific dashboard panel. Retrieves the data that powers a specific panel in a custom dashboard, including metrics, time series data, or aggregated values. Args: project_id: The project ID dashboard_id: The dashboard ID panel_id: The panel ID within the dashboard from_time: Optional start time (ISO format or relative like '-1h') to_time: Optional end time (ISO format or 'now') """ return await get_panel_data_impl( project_id, dashboard_id, panel_id, from_time, to_time )
- src/mcp_coroot/client.py:1502-1526 (handler)Core handler in CorootClient that makes the actual HTTP request to the Coroot API endpoint /api/project/{project_id}/panel/data to fetch the panel data.async def get_panel_data( self, project_id: str, dashboard_id: str, panel_id: str, params: dict[str, Any] | None = None, ) -> dict[str, Any]: """Get data for a specific dashboard panel. Args: project_id: The project ID dashboard_id: The dashboard ID panel_id: The panel ID params: Optional query parameters (time range, etc.) Returns: Dict containing panel data """ query_params = params or {} query_params.update({"dashboard": dashboard_id, "panel": panel_id}) response = await self._request( "GET", f"/api/project/{project_id}/panel/data", params=query_params ) data: dict[str, Any] = response.json() return data
- src/mcp_coroot/server.py:1881-1902 (helper)Helper implementation function in the MCP server that wraps the client call with error handling specific to the tool.async def get_panel_data_impl( project_id: str, dashboard_id: str, panel_id: str, from_time: str | None = None, to_time: str | None = None, ) -> dict[str, Any]: """Implementation for get_panel_data tool.""" try: client = get_client() params = {} if from_time: params["from"] = from_time if to_time: params["to"] = to_time data = await client.get_panel_data(project_id, dashboard_id, panel_id, params) return {"success": True, "data": data} except ValueError as e: return {"success": False, "error": str(e)} except Exception as e: return {"success": False, "error": f"Unexpected error: {str(e)}"}
- src/mcp_coroot/server.py:1904-1904 (registration)FastMCP tool registration decorator that registers the get_panel_data handler with name 'get_panel_data'.@mcp.tool()