Skip to main content
Glama
seletz

MCP Odoo Shell

by seletz

odoo_model_info

Retrieve detailed information about Odoo models including field definitions, table names, and descriptions to understand database structure and relationships.

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
NameRequiredDescriptionDefault
model_nameYes

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements the odoo_model_info tool. It generates and executes Odoo shell code to retrieve model information including description, table, and fields.
    @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)

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

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/seletz/mcp-odoo-shell'

If you have feedback or need assistance with the MCP directory API, please join our Discord server