Skip to main content
Glama
santoshray02

CSV Editor

by santoshray02

close_session

Terminate and clean up a CSV editing session to free system resources and ensure proper data handling.

Instructions

Close and clean up a session.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes

Implementation Reference

  • Core implementation of the close_session tool: removes the session from the session manager, handles errors, and returns a standardized result.
    async def close_session(
        session_id: str,
        ctx: Context = None
    ) -> Dict[str, Any]:
        """Close and clean up a session.
        
        Args:
            session_id: Session ID to close
            ctx: FastMCP context
        
        Returns:
            Operation result
        """
        try:
            session_manager = get_session_manager()
            removed = await session_manager.remove_session(session_id)
            
            if not removed:
                return OperationResult(
                    success=False,
                    message="Session not found",
                    error="Invalid session ID"
                ).model_dump()
            
            if ctx:
                await ctx.info(f"Closed session {session_id}")
            
            return OperationResult(
                success=True,
                message=f"Session {session_id} closed successfully",
                session_id=session_id
            ).model_dump()
            
        except Exception as e:
            if ctx:
                await ctx.error(f"Failed to close session: {str(e)}")
            return OperationResult(
                success=False,
                message="Failed to close session",
                error=str(e)
            ).model_dump()
  • MCP tool registration for 'close_session' that delegates to the underlying implementation (_close_session).
    @mcp.tool
    async def close_session(
        session_id: str,
        ctx: Context = None
    ) -> Dict[str, Any]:
        """Close and clean up a session."""
        return await _close_session(session_id, ctx)

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