Skip to main content
Glama
NovaAI-innovation

CSV MCP Server

delete_csv

Remove CSV files from your filesystem with optional backup functionality to prevent data loss during deletion operations.

Instructions

Delete a CSV file (with backup if enabled).

Args:
    filename: Name of the CSV file to delete

Returns:
    Dictionary with deletion results

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYes

Implementation Reference

  • MCP tool handler for delete_csv. Decorated with @mcp.tool() which registers the tool. Delegates execution to csv_manager.delete_csv with error handling.
    @mcp.tool()
    def delete_csv(filename: str) -> Dict[str, Any]:
        """
        Delete a CSV file (with backup if enabled).
        
        Args:
            filename: Name of the CSV file to delete
        
        Returns:
            Dictionary with deletion results
        """
        try:
            return csv_manager.delete_csv(filename)
        except Exception as e:
            return {"success": False, "error": str(e)}
  • Core deletion logic in CSVManager class. Handles file path resolution, backup creation, file deletion, logging, and returns detailed success/error information.
    def delete_csv(self, filename: str) -> Dict[str, Any]:
        """Delete a CSV file."""
        filepath = self._get_file_path(filename)
        
        if not filepath.exists():
            raise FileNotFoundError(f"CSV file '{filename}' not found")
        
        try:
            # Create backup before deletion
            backup_path = self._create_backup(filepath)
            
            # Delete the file
            filepath.unlink()
            
            logger.info(f"Deleted CSV file: {filepath}")
            return {
                "success": True,
                "filename": filename,
                "deleted_filepath": str(filepath),
                "backup_created": backup_path is not None,
                "backup_path": str(backup_path) if backup_path else None
            }
        except Exception as e:
            logger.error(f"Failed to delete CSV: {e}")
            raise

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/NovaAI-innovation/csv-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server