reset_odoo_shell
Restart the Odoo shell session to clear session state and recover from errors by terminating the current process.
Instructions
Reset the Odoo shell session (restart the shell process).
Terminates the current shell process and clears the global shell manager,
which will cause a new shell to be started on the next code execution.
This is useful for clearing session state or recovering from errors.
:return: Success message or error description
:rtype: str
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp_odoo_shell/tools.py:41-59 (handler)The reset_odoo_shell MCP tool handler: resets the Odoo shell session by terminating the current process and clearing the global shell manager via reset_shell_manager.@mcp.tool() def reset_odoo_shell() -> str: """ Reset the Odoo shell session (restart the shell process). Terminates the current shell process and clears the global shell manager, which will cause a new shell to be started on the next code execution. This is useful for clearing session state or recovering from errors. :return: Success message or error description :rtype: str """ from .server import reset_shell_manager try: result = reset_shell_manager() return result except Exception as e: return f"Error resetting shell: {str(e)}"
- src/mcp_odoo_shell/server.py:45-62 (helper)Helper function that implements the core logic to stop the shell process and reset the global shell_manager instance.def reset_shell_manager() -> str: """ Reset the shell manager (restart the shell process). Terminates the current shell process and clears the global shell manager, which will cause a new shell to be started on the next access. :return: Success message or error description :rtype: str """ global shell_manager try: if shell_manager: shell_manager.stop() shell_manager = None return "Odoo shell session reset successfully" except Exception as e: return f"Error resetting shell: {str(e)}"
- src/mcp_odoo_shell/__init__.py:12-12 (registration)Import of the reset_odoo_shell tool function, which triggers auto-registration via @mcp.tool() decorator when the module is imported.from .tools import execute_odoo_code, reset_odoo_shell, list_odoo_models, odoo_model_info