Skip to main content
Glama

close_session

Terminate and clean up a session in the CSV Editor MCP server to free resources and ensure efficient data processing. Requires a valid session_id.

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 specified session from the session manager, handles errors, provides logging via context, and returns a standardized OperationResult.
    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()
  • Registers 'close_session' as an MCP tool using the @mcp.tool decorator. This is the entry point for tool calls, delegating to the core handler in io_operations.py.
    @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)
  • Imports the close_session implementation from io_operations.py, aliasing it as _close_session for use in the registered tool.
    from .tools.io_operations import ( load_csv as _load_csv, load_csv_from_url as _load_csv_from_url, load_csv_from_content as _load_csv_from_content, export_csv as _export_csv, get_session_info as _get_session_info, list_sessions as _list_sessions, close_session as _close_session )
  • Re-exports close_session from io_operations.py for compatibility in data_operations module.
    from .io_operations import ( load_csv, load_csv_from_url, load_csv_from_content, export_csv, get_session_info, list_sessions, close_session )

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