list_odoo_models
Retrieve available Odoo model names from the registry, with optional filtering by pattern to find specific models.
Instructions
List available Odoo models, optionally filtered by pattern.
Queries the Odoo registry to retrieve all available model names.
If a pattern is provided, only models containing that pattern
in their name will be returned.
:param pattern: Optional pattern to filter model names (case-sensitive)
:type pattern: str
:return: List of model names, one per line
:rtype: str
.. note::
Results are limited to the first 50 matches to prevent overwhelming output.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | No |
Implementation Reference
- src/mcp_odoo_shell/tools.py:62-87 (handler)The main handler function for the 'list_odoo_models' MCP tool. Decorated with @mcp.tool() for automatic registration. Generates and executes Odoo shell code to list model names matching the optional pattern, limited to 50 results.@mcp.tool() def list_odoo_models(pattern: str = "") -> str: """ List available Odoo models, optionally filtered by pattern. Queries the Odoo registry to retrieve all available model names. If a pattern is provided, only models containing that pattern in their name will be returned. :param pattern: Optional pattern to filter model names (case-sensitive) :type pattern: str :return: List of model names, one per line :rtype: str .. note:: Results are limited to the first 50 matches to prevent overwhelming output. """ code = f""" models = env.registry.keys() if '{pattern}': models = [m for m in models if '{pattern}' in m] for model in sorted(models)[:50]: # Limit to first 50 print(model) """ return execute_odoo_code(code)