Repository navigation
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 1:49 PM ET / 17:49 UTC. ClawSweeper reviewWhat this changesThe PR adds a plugin-author note that factory-returned tools receive the tool-call ID before their parameter object. Merge readiness✅ Ready for maintainer review No blocking findings. The documentation accurately distinguishes factory-returned core tools from declarative tool-plugin handlers, and current main still lacks this clarification. Priority: P3 Review scores
Verification
How this fits togetherTool plugins let plugin authors declare either a declarative handler or a runtime factory. Declarative handlers pass through an SDK adapter, while factory-returned agent tools flow directly into the agent runtime and receive its native execute arguments. flowchart LR
A[Plugin author] --> B[Tool plugin declaration]
B --> C{Tool form}
C -->|Declarative| D[SDK execution adapter]
C -->|Factory| E[Core agent tool]
D --> F[Parameters-first handler]
E --> G[Tool-call-ID-first handler]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceDocs +10. Total +10 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep the clarification narrow and land it as documentation for the existing public factory-tool contract. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR documents an existing SDK contract, which current source directly confirms. Is this the best way to solve the issue? Yes. Documenting the intentional adapter boundary is the narrowest maintainable solution; changing the core execute signature would alter a broader public SDK contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bca206d794bd. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
e34c723 to
bee8875
Compare
|
Fixed in
It now reads:
Same rebase also picked up current |
bee8875 to
2fbd35e
Compare
2fbd35e to
7b83b02
Compare
|
Rebased onto current Before rebasing I checked the change was still worth carrying rather than just replaying cleanly: every file it touches still exists on Docs only, one file ( Still useful from my side, so I have not closed it. Happy to close instead if you would rather not take it. AI-assisted. |
7b83b02 to
93e2c6a
Compare
|
Rebased onto current This branch was carrying a It also removes a recurring nuisance: that generated file is rewritten on Verified at head Sorry for the noise in the earlier diff. AI-assisted. |
93e2c6a to
c8f7213
Compare
|
Rebased onto current The conflict was a real one this time, not the usual generated-baseline churn: I re-verified the claim still holds on current
So the gap this PR fills is unchanged. Docs-only, one file, AI-assisted. |
c8f7213 to
155cd96
Compare
155cd96 to
5546661
Compare
5546661 to
81a5794
Compare
|
Merged via squash.
|
* docs(plugins): note the factory tool execute signature * docs(plugins): state the factory tool result and execute signature precisely
What Problem This Solves
docs/plugins/tool-plugins.mdshows a declarative tool whose handler isexecute({ symbol }, config, context), with params first. About thirty lines later, on the same page, it introduces factory tools without saying that a factory's tool uses the opposite argument order.A plugin author who reads the page top to bottom, then writes a factory tool, gets the tool call ID where they expect their params. That is what #120061 reports:
args[0]is"toolu_01FJWJ..."andargs[1]is{ path: "." }.The runtime is behaving correctly here, and so is every other page.
docs/plugins/building-plugins.md:144and:260both show theapi.registerToolform asasync execute(_id, params), which is right. The gap is only that the tool-plugins page never connects its own factory section to that contract, and it is the page a tool author is most likely to be reading.Why This Change Was Made
The two argument orders are both real and both intentional, so this documents the seam rather than changing it.
src/plugin-sdk/tool-plugin.ts:230registersexecute: async (toolCallId, params, signal, onUpdate) => ... execute(params, config, { api, signal, toolCallId, onUpdate }), which is what turns the runtime signature into the documentedexecute(params, config, context)atsrc/plugin-sdk/tool-plugin.ts:98.src/plugin-sdk/tool-plugin.ts:207passes the factory straight toapi.registerToolandcontinues, so whatever the factory returns keeps the core contract atpackages/agent-core/src/types.ts:560:execute(toolCallId, params, signal?, onUpdate?).So the note says exactly that, points at the
api.registerToolexamples that already show the same shape, and states the failure mode in the words an author will recognize.I did not touch the signatures. Changing the core
AgentToolargument order would reach every tool in the repo, and the shim suggested in #120061 (passing params at botharg0andarg1) would add a permanent compatibility branch to a public SDK surface to paper over a docs gap. Documenting the seam is the smaller and more honest fix.User Impact
Plugin authors reading the tool-plugins walkthrough now learn the factory argument order on the page where they need it, instead of discovering it by logging
args.Docs only. No code, config, schema, or default surface changes.
Evidence
Claims verified against current
mainatc245cfc19c7rather than from memory:src/plugin-sdk/tool-plugin.ts:98declares the declarative handler as(params, config, context).src/plugin-sdk/tool-plugin.ts:207registers a factory with no execute adapter.src/plugin-sdk/tool-plugin.ts:230is the adapter the declarative branch uses.packages/agent-core/src/types.ts:560is the coreexecute(toolCallId, params, signal?, onUpdate?)contract.docs/plugins/building-plugins.md:144and:260already showasync execute(_id, params), so the new text agrees with the rest of the docs.openclaw/plugin-sdk/tool-pluginis a published subpath (package.jsonexports plusscripts/lib/plugin-sdk-entrypoints.json:313), so this is a public SDK surface and not an internal detail.git diff --checkis clean, the added link/plugins/building-pluginsis root-relative with no extension per the docs guide, and the file has no em dashes.One thing I did not do: I did not build a plugin and observe the argument order at runtime. The claim rests on reading the registration path end to end in the four places cited above. If a maintainer wants a live plugin trace before merging, say so and I will put one together.
AI-assisted: written with AI assistance. I read the registration path, the core tool type, and the existing docs pages myself before writing the note.
Refs #120061. I am deliberately not closing that issue with this PR: it asks for the factory argument order to change, and whether to alter a public SDK contract is a maintainer product decision. This only removes the documentation gap that made the current behavior surprising.