reset_odoo_shell
Reset the Odoo shell session to clear session state or recover from errors. This tool terminates the current shell process, enabling a fresh session upon next code execution.
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 MCP tool handler function for 'reset_odoo_shell'. It is decorated with @mcp.tool() for automatic registration and simply delegates to the reset_shell_manager() helper, returning its result or an error message.@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)Supporting utility function that performs the actual shell reset: terminates the current OdooShellManager process via stop() and clears 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 statement in __init__.py that loads the tool functions, triggering their definition and @mcp.tool() registration during module import.from .tools import execute_odoo_code, reset_odoo_shell, list_odoo_models, odoo_model_info