Skip to main content
Glama

delete_csv

Remove CSV files from your filesystem while maintaining optional backup protection. This tool securely deletes specified CSV documents and provides confirmation of the deletion process.

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

  • The MCP tool handler for 'delete_csv'. It is registered via @mcp.tool() decorator and delegates execution to the CSVManager instance's delete_csv method.
    @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)}
  • The core implementation of the delete_csv functionality in the CSVManager class. Handles file path resolution, backup creation, file deletion, and error handling.
    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
  • Instantiation of the global CSVManager instance used by the delete_csv tool and other tools.
    csv_manager = CSVManager( storage_path=CSV_STORAGE_PATH, max_file_size_mb=CSV_MAX_FILE_SIZE, backup_enabled=CSV_BACKUP_ENABLED )
  • The @mcp.tool() decorator registers the delete_csv function as an MCP tool.
    @mcp.tool()

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