get_panel_data
Retrieve dashboard panel data within a custom dashboard, including metrics, time series, or aggregated values, using project, dashboard, and panel IDs.
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 |
|---|---|---|---|
| dashboard_id | Yes | ||
| from_time | No | ||
| panel_id | Yes | ||
| project_id | Yes | ||
| to_time | No |
Implementation Reference
- src/mcp_coroot/server.py:1881-1902 (handler)Core handler function that implements the get_panel_data tool logic by preparing parameters and calling the CorootClient.get_panel_data method.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-1927 (registration)MCP tool registration using @mcp.tool() decorator, defining input schema via parameters and comprehensive docstring.@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 (helper)Supporting client method in CorootClient that performs the actual HTTP GET request to the Coroot API endpoint /api/project/{project_id}/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