disable_auto_save
Prevent automatic saving of CSV files during editing sessions to maintain manual control over file versions and prevent unintended changes.
Instructions
Disable auto-save for a session.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes |
Implementation Reference
- Main handler implementation for the 'disable_auto_save' tool. Retrieves the CSV session and invokes the session's disable_auto_save method, handling errors and logging.async def disable_auto_save( session_id: str, ctx: Context = None ) -> Dict[str, Any]: """ Disable auto-save for a session. Args: session_id: Session identifier ctx: FastMCP context Returns: Dict with success status """ try: manager = get_session_manager() session = manager.get_session(session_id) if not session: return OperationResult( success=False, message="Session not found", error=f"No session with ID: {session_id}" ).model_dump() result = await session.disable_auto_save() if result["success"]: if ctx: await ctx.info(f"Auto-save disabled for session {session_id}") return OperationResult( success=True, message="Auto-save disabled", session_id=session_id ).model_dump() else: return OperationResult( success=False, message="Failed to disable auto-save", error=result.get("error") ).model_dump() except Exception as e: logger.error(f"Error disabling auto-save: {str(e)}") if ctx: await ctx.error(f"Failed to disable auto-save: {str(e)}") return OperationResult( success=False, message="Failed to disable auto-save", error=str(e) ).model_dump()
- src/csv_editor/server.py:462-469 (registration)Registers the 'disable_auto_save' tool with the MCP framework using the @mcp.tool decorator. This is the entry point exposed to MCP clients, delegating to the implementation in auto_save_operations.@mcp.tool async def disable_auto_save( session_id: str, ctx: Context = None ) -> Dict[str, Any]: """Disable auto-save for a session.""" return await _disable_auto_save(session_id, ctx)
- Core logic in CSVSession class that stops the periodic auto-save timer and disables the configuration.async def disable_auto_save(self) -> Dict[str, Any]: """Disable auto-save.""" try: await self.auto_save_manager.stop_periodic_save() self.auto_save_config.enabled = False return {"success": True, "message": "Auto-save disabled"} except Exception as e: return {"success": False, "error": str(e)}