Skip to content

[18.0][MIG] ai_tool_read: Migration to 18.0 - #135

Open
AungKoKoLin1997 wants to merge 6 commits into
OCA:18.0from
qrtl:18.0-mig-ai_tool_read
Open

AungKoKoLin1997 wants to merge 6 commits into
OCA:18.0from
qrtl:18.0-mig-ai_tool_read

Conversation

@AungKoKoLin1997

@AungKoKoLin1997 AungKoKoLin1997 commented Oct 20, 2026 •

Copy link
Copy Markdown

Migration of ai_tool_read to 18.0.

@qrtl QT7379

@oca-cla-bot

oca-cla-bot Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@OCA-git-bot OCA-git-bot added mod:ai_tool Module ai_tool series:18.0 mod:ai_tool_read Module ai_tool_read labels Oct 20, 2026
nobuQuartile and others added 6 commits October 20, 2026 07:55
ai_tool lets modules expose tools to AI agents, but each one has to be
written for a specific model. This module adds three generic tools,
list_models, get_fields and search_read, so that an agent can read any
model the calling user is allowed to read, with the user's own access
rights (ACLs, record rules and field groups still apply).

Personal or otherwise sensitive data can be kept out of the results with
a new "AI Read Forbidden" flag on ir.model.fields. A flagged field is
never returned nor described, and neither is any field exposing its
value: related fields, _inherits included, and computed fields depending
on it, as the registry reports them. Many2one values are returned as
plain IDs, and display names computed on the fly are left out, as both
come from name_get, which may show another record's forbidden field.

Searches are not restricted, so an agent probing on purpose can still
find records by a forbidden value; the README lists those cases.

search_read returns the stored fields unless a field list is given, pages
its results with limit, offset and has_more, and does not fail as a whole
because of one field or record the user may not read.

Assisted-by: Claude Opus 5.5
- _ai_jsonify: note that isinstance(date) also covers datetime.
- _ai_get_fields: document that reporting forbidden fields under
  "hidden" is deliberate, unlike group-restricted fields which are not
  disclosed.
- _ai_forbidden_fields: return early when no field is flagged.
- _ai_search_read: an explicit empty fields list now returns ids only;
  previously it fell back to the stored-fields default, same as no
  fields argument at all.

Assisted-by: Devin:SWE-2 High
Add a USAGE section covering how the registered ai.tool records are
consumed (e.g. via ai_oca_mcp), the list_models / get_fields /
search_read agent workflow, and the search_read arguments with an
example. Drop the "This module" opening from the description.

Assisted-by: Devin:SWE-2 High
- The help of "AI Read Forbidden" still said that flagged fields are
  kept out of domains and orderings. They are not since the tools stopped
  rejecting them (see Known issues): say that the flag keeps values out of
  the results only, so that an administrator does not rely on it against
  filtering.
- A negative offset reached PostgreSQL and failed the call with a SQL
  error. Treat it as 0, next to the limit guard.
- The tool descriptions kept the leading newline and indentation of the
  XML text, shown as is in the form view and sent to MCP clients. Write
  each one as a single paragraph.
- CONFIGURE.md: start the list items with a capital letter.

Assisted-by: Claude Opus 5.5
Assisted-by: Claude Opus 5.5
Assisted-by: Claude Opus 5.5
@OCA-git-bot OCA-git-bot removed the mod:ai_tool Module ai_tool label Oct 20, 2026
@AungKoKoLin1997
AungKoKoLin1997 marked this pull request as ready for review October 20, 2026 07:57

@nobuQuartile nobuQuartile left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM: Code review.

This error will be fixed by #118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants