delete_integration
Remove unwanted or outdated integration configurations from Coroot’s observability platform. Specifies the project ID and integration type for precise deletion, ensuring clean and efficient integration management.
Instructions
Delete an integration configuration.
Removes an integration from the project.
Args: project_id: Project ID integration_type: Type of integration to delete
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| integration_type | Yes | ||
| project_id | Yes |
Implementation Reference
- src/mcp_coroot/server.py:1447-1458 (handler)The MCP tool handler function for 'delete_integration', registered via @mcp.tool() decorator. It delegates to the implementation helper.@mcp.tool() async def delete_integration(project_id: str, integration_type: str) -> dict[str, Any]: """Delete an integration configuration. Removes an integration from the project. Args: project_id: Project ID integration_type: Type of integration to delete """ return await delete_integration_impl(project_id, integration_type) # type: ignore[no-any-return]
- src/mcp_coroot/server.py:1435-1445 (helper)Helper implementation function that calls CorootClient.delete_integration and formats the response.async def delete_integration_impl( project_id: str, integration_type: str ) -> dict[str, Any]: """Delete an integration.""" result = await get_client().delete_integration(project_id, integration_type) return { "success": True, "message": f"{integration_type} integration deleted successfully", "result": result, }
- src/mcp_coroot/client.py:1061-1094 (handler)CorootClient method implementing the actual HTTP DELETE request to the Coroot API to delete the integration.async def delete_integration( self, project_id: str, integration_type: str ) -> dict[str, Any]: """Delete an integration configuration. Args: project_id: Project ID. integration_type: Type of integration to delete. Returns: Deletion status. """ response = await self._request( "DELETE", f"/api/project/{project_id}/integrations/{integration_type}" ) # 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:93-112 (helper)Shared helper to get or lazily initialize the CorootClient instance used by all 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
- src/mcp_coroot/server.py:44-86 (helper)Error handling decorator applied to all tool implementations, standardizing error responses.def handle_errors(func: Callable[..., Any]) -> Callable[..., Any]: """Decorator to handle common errors in tool implementations.""" @wraps(func) async def wrapper(*args: Any, **kwargs: Any) -> dict[str, Any]: try: return await func(*args, **kwargs) # type: ignore[no-any-return] except ValueError as e: # Handle missing credentials or other validation errors return { "success": False, "error": str(e), "error_type": "validation", } except CorootError as e: # Handle Coroot API errors (including authentication) error_msg = str(e) if "Authentication failed" in error_msg: return { "success": False, "error": error_msg, "error_type": "authentication", } elif "401" in error_msg or "Unauthorized" in error_msg: return { "success": False, "error": "Authentication required. Please check your credentials.", "error_type": "authentication", } return { "success": False, "error": error_msg, "error_type": "api_error", } except Exception as e: # Handle unexpected errors return { "success": False, "error": f"Unexpected error: {str(e)}", "error_type": "unknown", } return wrapper