list_odoo_models
Retrieve available Odoo models from the registry, with optional filtering by a case-sensitive pattern. Returns up to 50 matching model names for streamlined database introspection.
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 handler function for the 'list_odoo_models' tool, decorated with @mcp.tool() which handles registration and schema from the signature/docstring. It generates and executes Odoo shell code to list models 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)