delete_dashboard
Remove custom dashboards from Coroot projects to manage monitoring interfaces and maintain organized performance tracking environments.
Instructions
Delete a custom dashboard.
Permanently removes a dashboard from the project.
Args: project_id: Project ID dashboard_id: Dashboard ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| dashboard_id | Yes |
Implementation Reference
- src/mcp_coroot/client.py:1215-1251 (handler)Core implementation of dashboard deletion: sends POST request to Coroot API /api/project/{project_id}/dashboards/{dashboard_id} with {"action": "delete"} and handles various response types.async def delete_dashboard( self, project_id: str, dashboard_id: str ) -> dict[str, Any]: """Delete a dashboard. Args: project_id: Project ID. dashboard_id: Dashboard ID. Returns: Deletion status. """ request_data = {"action": "delete"} response = await self._request( "POST", f"/api/project/{project_id}/dashboards/{dashboard_id}", json=request_data, ) # Handle empty response (204 or empty body) if response.status_code == 204: return {"status": "deleted"} # Try to parse JSON response try: content = response.text.strip() if not content: # Empty response body with 200 status return {"status": "deleted"} data: dict[str, Any] = response.json() return data except Exception: # If parsing fails, assume success if status code is 2xx if 200 <= response.status_code < 300: return {"status": "deleted"} raise
- src/mcp_coroot/server.py:1392-1402 (registration)MCP tool registration for 'delete_dashboard' using FastMCP @mcp.tool() decorator. This defines the tool schema via parameters and docstring, and points to the implementation.@mcp.tool() async def delete_dashboard(project_id: str, dashboard_id: str) -> dict[str, Any]: """Delete a custom dashboard. Permanently removes a dashboard from the project. Args: project_id: Project ID dashboard_id: Dashboard ID """ return await delete_dashboard_impl(project_id, dashboard_id) # type: ignore[no-any-return]
- src/mcp_coroot/server.py:1381-1389 (handler)MCP server wrapper handler that calls the CorootClient.delete_dashboard method, handles errors via @handle_errors decorator, and formats the success response.async def delete_dashboard_impl(project_id: str, dashboard_id: str) -> dict[str, Any]: """Delete a dashboard.""" client = get_client() result = await client.delete_dashboard(project_id, dashboard_id) return { "success": True, "message": "Dashboard deleted successfully", "result": result, }