Skip to main content
Glama
santoshray02

CSV Editor

by santoshray02

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
NameRequiredDescriptionDefault
session_idYes

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()
  • 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)}

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/santoshray02/csv-editor'

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