OdooWiki OCA HUB
Uncategorised License: AGPL-3

This technical module provides the base infrastructure for defining AI tools in Odoo. It allows other modules to register callable functions as AI tools, which can then be used by MCP servers, automation flows, or any AI-native integration.

auto_awesome What this module does

AI-generated from the code · Odoo 19.0

This technical module creates a registry of AI tools in Odoo, letting developers declare callable functions that AI assistants or MCP servers can use, such as getting today's date or posting a message on a record.

This module adds a new screen called AI Tool, found under the AI menu in Odoo's settings area. Each entry describes one callable function: its name, a description, the Odoo model it belongs to, the function name, and a kind that says whether the function works on its own, needs a record, or runs on a specific record.

Users with basic access can only view this list; they cannot create, edit, or delete entries. The entries themselves are normally created by other modules or by developers, not typed in by hand.

Two ready-made tools are included: - get_date: returns the current date. - post_message: posts a message on an existing record, converting Markdown text to safe HTML when the Markdown library is available, otherwise plain text.

The module also defines how a tool is executed: it checks that a record is supplied when required, and that the record belongs to the expected model, raising an error otherwise. It exposes each tool's input and output definition so external AI integrations can understand what arguments to send.

It touches the ai.tool model and the ir.model model, and depends on the mail module for message posting. No scheduled jobs, emails, or automatic computations are added.

Depends on

mail

Menus it adds

AI
Models and fields (1)
  • ai.tool · new modelkind, name, model_id, description, function_name

Text generated by AI (DeepSeek) from reading the Odoo 19.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 3 confirmed, 6 with no information of 9 versions.

terminal Installation and usage

OCA documentation · Odoo 19.0

This module is technical, however, it adds some specific functions that might be used in glue modules.

For example, if we want to add on sales a functionality to find the sales on a period, we should do:

<odoo>
    <record model="ai.tool" id="total_sale_order_tool">
        <field name="name">total_sale_order</field>
        <field
            name="description"
        >Calculate the total amount of sale orders within a date range and optionally for a specific customer.</field>
        <field name="model_id" ref="model_sale_order" />
        <field name="function_name">_mcp_total_sale_order</field>
    </record>
</odoo>
from odoo.addons.ai_tool.tools import aitool

class SaleOrder(models.Model):
    _inherit = "sale.order"

    @aitool(
        input_schema={
            "start_date": {"type": "date"},
            "end_date": {"type": "date"},
            "customer_id": {"type": "integer"},
        },
        required_inputs=["start_date", "end_date"],
        output_schema={
            "amount_total": {"type": "number"},
        },
    )
    def _mcp_total_sale_order(self, start_date, end_date, customer_id=None):
        domain = [("date_order", ">=", start_date), ("date_order", "<=", end_date)]
        if customer_id:
            domain.append(("partner_id", "=", customer_id))
        orders = self.read_group(domain, ["amount_total"], [])
        return {
            "amount_total": (orders[0]["amount_total"] or 0) if orders else 0,
        }

Be aware that this kind of elements must allways return a dict. All the elements will be defined in output_schema.

Also, for the signature of the functions, all fields must be in the inputs with the exception of record. This argument is protected and is used to define integrations with automation. This argument is required in generic_model and record tools.

On generic_models we are expecting this value because we want to do a specific action with the model.

No verified information in OCA: Installation, Configuration.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.