clear_session
Clear a Python REPL session's state and history to reset the execution environment and remove previous code outputs.
Instructions
Clear a REPL session's state and history.
Args:
session_id: Session ID to clear
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | No | default |
Implementation Reference
- mcp_python_interpreter/server.py:872-883 (handler)The clear_session tool handler: deletes the REPL session for the given session_id from the global _sessions dictionary and returns a confirmation message.def clear_session(session_id: str = "default") -> str: """ Clear a REPL session's state and history. Args: session_id: Session ID to clear """ if session_id in _sessions: del _sessions[session_id] return f"Session '{session_id}' cleared." else: return f"Session '{session_id}' not found."