odoo_model_info
Retrieve detailed information about an Odoo model, including its description, database table name, and field definitions, using the specified model name.
Instructions
Get information about a specific Odoo model.
Retrieves detailed information about the specified model including
its description, database table name, and field definitions.
:param model_name: Name of the Odoo model (e.g., 'res.partner', 'sale.order')
:type model_name: str
:return: Formatted information about the model and its fields
:rtype: str
.. example::
>>> odoo_model_info('res.partner')
Model: res.partner
Description: Partner
Table: res_partner
Fields:
name: Char
email: Char
phone: Char
...
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model_name | Yes |
Implementation Reference
- src/mcp_odoo_shell/tools.py:89-128 (handler)The core handler function for the 'odoo_model_info' tool. Decorated with @mcp.tool() for automatic MCP registration. Generates and executes Odoo shell code to retrieve and print the model's description, table name, and field list.@mcp.tool() def odoo_model_info(model_name: str) -> str: """ Get information about a specific Odoo model. Retrieves detailed information about the specified model including its description, database table name, and field definitions. :param model_name: Name of the Odoo model (e.g., 'res.partner', 'sale.order') :type model_name: str :return: Formatted information about the model and its fields :rtype: str .. example:: >>> odoo_model_info('res.partner') Model: res.partner Description: Partner Table: res_partner Fields: name: Char email: Char phone: Char ... """ code = f""" try: model = env['{model_name}'] print(f"Model: {model_name}") print(f"Description: {{model._description}}") print(f"Table: {{model._table}}") print("\\nFields:") for field_name, field in model._fields.items(): print(f" {{field_name}}: {{type(field).__name__}}") except KeyError: print(f"Model '{model_name}' not found") except Exception as e: print(f"Error: {{e}}") """ return execute_odoo_code(code)