Skip to content

[18.0][FIX] ai_tool: date output schema and tool model metadata access - #118

Open
nobuQuartile wants to merge 2 commits into
OCA:18.0from
qrtl:18.0-fix-ai_tool
Open

nobuQuartile wants to merge 2 commits into
OCA:18.0from
qrtl:18.0-fix-ai_tool

Conversation

@nobuQuartile

@nobuQuartile nobuQuartile commented Oct 1, 2026 •

Copy link
Copy Markdown

Forward-port of #89 and #94 to 18.0.

Fixes

_ai_get_date output schema (#89): _ai_get_date declared {"type": "date"}, which is not a valid JSON Schema type. It now declares {"type": "string", "format": "date"}.

Tool model metadata for non-admin users (#94): _get_tool_definition and _execute_tool read model_id.model (ir.model), which a plain internal user cannot read, so building or running a tool raised AccessError. The model name is now resolved with sudo(). The tool itself still runs with the caller's rights.

Tests

Added test_tool_non_admin_user: a user who has only base.group_user can build the tool definition and execute a generic tool.

@qrtl

ZachDreamZ and others added 2 commits September 30, 2026 00:36
The JSON Schema spec does not define 'date' as a valid type.
Use 'string' with format 'date' instead, which is the correct
way to represent a date in JSON Schema.

(cherry picked from commit 3efa79a)
Building and dispatching a tool reads ir.model via model_id, which a
plain internal user (base.group_user) cannot access. Resolve the model
name with sudo() while keeping the actual tool execution under the
caller's own permissions, so non-admin MCP keys can list and call tools.

Add a regression test exercising a non-admin user through
_get_tool_definition and _execute_tool.

(cherry picked from commit 16beaa7)
@oca-cla-bot

oca-cla-bot Bot commented Oct 1, 2026

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

CLA not signed

@nobuQuartile

Copy link
Copy Markdown
Author

Hi @ZachDreamZ,

I forward-ported your commit from #89 ("fix: _ai_get_date output_schema uses invalid JSON Schema type 'date'") to 18.0 and 19.0 (#119), keeping you as the author.

The CLA check is failing because the commit author email (zachdreambot@users.noreply.github.com) hasn't signed the OCA CLA. Could you sign it via the link in the bot comment above?

Thank you for your contribution!

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.

2 participants