Repository navigation
refactor(odoo)!: registerTool, Odoo 19 fixes and leaner tool surface - #31
Merged
Merged
Conversation
Fixes:
- name_search with a domain failed on Odoo 19 ("unexpected keyword
argument 'args'"): name and domain are now sent positionally, which
works on 18 (`args`) and 19 (`domain`).
- The request timeout was cleared once headers arrived, so a stalled
body hung forever. AbortSignal.timeout now bounds the body read too.
Changes:
- Move to McpServer.registerTool with strict zod schemas as the single
source of truth; drop the hand-written JSON Schemas, parseOrThrow and
the dispatch switch.
- Collapse the error hierarchy into one OdooError whose message carries
the [CODE] prefix.
- search_read defaults to limit 100 and returns limit_reached: true on a
full page.
- Add readOnlyHint / destructiveHint tool annotations.
- Trim descriptions and instructions (~5.8k -> ~3.3k tokens per session);
instructions now fit under the ~2 KB hosts truncate at.
- Remove dead code: validators.js, clientRegistry.js, index.d.ts,
clearFieldsCache, shutdown handlers.
- Require zod ^3.25 (MCP SDK 1.29 peer range).
BREAKING CHANGE: ODOO_INPUT_INVALID is gone; invalid arguments now
return the SDK's "Input validation error: ..." text. search_read without
a limit now returns at most 100 records.
This was referenced Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A review of the Odoo server found two real bugs and a tool surface that was larger than it needed to be:
name_searchwith adomainfailed on every Odoo 19 instance:ResCountry.name_search() got an unexpected keyword argument 'args'. Odoo 18 names that parameterargs; Odoo 19 renamed it todomain.This is the planned
1.0.0change for@unclecat/mcp-odoo(major changeset included).What changes
name_searchargssent as a kwarg (breaks on 19)setTimeout, cleared after headersAbortSignal.timeout, which also bounds the body readServer+ hand-written JSON Schema + zod +switchdispatchMcpServer.registerToolwith strict zod schemas onlydetails/retryablenever reached the clientOdooError(code, message)whose message carries[CODE]search_readlimitdefaults to 100; returnslimit_reached: trueon a full pagereadOnlyHinton reads,destructiveHintonwrite/unlink/call_methodvalidators.js,clientRegistry.js,index.d.ts(declared exportsindex.jsnever had),clearFieldsCache, shutdown handlersNet: 19 files, +650 / −2,090 lines.
Breaking changes
ODOO_INPUT_INVALIDis gone. Invalid arguments, including unknown keys, now return the SDK'sInput validation error: ...text.search_readwithout alimitreturns at most 100 records.Verification
pnpm -r test: odoo 50, obsidian 41, db 203 passing. Odoo coverage is 98.9%. Lint and format are clean, andpnpm install --frozen-lockfilepasses.name_searchpayload, a stalled-body timeout, the default limit, annotations, strict-key rejection and the under-2 KB instructions size.name_searchwith a domain now returns[[241, "Vietnam"]];search_readreturns 100 rows withlimit_reached: true;read_groupworks; an unknown key is rejected.Follow-ups
/jsonrpcis deprecated in 19 and removed in 22) lives onfeat/odoo-json2-transportand will rebase onto this branch.1.0.0release:majorchangesets fordbandobsidian, and switch the README install commands to@1.