Repository navigation
fix(tools): declare transfer_nft.fromAddress in getToolDefinitions - #113
Merged
portdeveloper merged 1 commit intoOct 2, 2026
Merged
portdeveloper merged 1 commit into
portdeveloper merged 1 commit into
Conversation
The native tool schema dropped the optional fromAddress that nativeSystemPrompt() advertises as fromAddress?, so a native-mode model could either send an undeclared argument or never learn the approval transfer path exists. Add it as an optional string property (not in required) and pin both the transfer_nft schema and a generic ACTIONS-vs-schema drift check so the two surfaces cannot diverge again.
Collaborator
Author
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.
Closes #112
What
getToolDefinitions()hand-writes the tool schemas whilesystemPrompt()/nativeSystemPrompt()are generated fromACTIONS, and thetransfer_nftentry had drifted: the prompt advertisestransfer_nft(to, contractAddress, tokenId, fromAddress?)but the schema only declaredto,contractAddress,tokenId. WithUSE_NATIVE_TOOLSdefaulting totrue, that is the schema the model ships with — so a model following the prose sent an undeclared argument, and a model reading the schema never learned the approval-transfer path exists.src/tools.mjs: addfromAddressto thetransfer_nftschema as an optionalstringproperty with a description (defaults to the agent's own wallet; set only for a token owned by another address that has approved this account). It stays out ofrequired, matchingACTIONS.optionalArgsand both prompt lines.test/native-tools-no-model.test.mjs: pin thetransfer_nftschema (property present,string, not inrequired), and add a drift check asserting every tool'spropertiesequalACTIONS.args ∪ optionalArgsand itsrequiredequalsargsminusoptionalArgs(accountandget_nftsexcepted —hasRequiredArgs()lets those run with no arguments). That check is what would have caught this class of bug for all 9 tools, not just this one.dispatchToolCall()already forwardedfromAddressandrunActionalready validates it (from #69), so this is schema-only — no behavior change.Testing
['to', 'contractAddress', 'tokenId', 'fromAddress']withrequiredstill["to","contractAddress","tokenId"].npm test: 539 tests, 531 pass, 8 fail — the same 8 fail on cleanmainhere (empty.envseed / no model env), so no new failures; both new tests pass.src/tools.mjshunk makes both new tests fail, so they pin the fix.npm run buildOK;npm run smoke→SMOKE_OK(v0 path, no model available for native tool-calling locally).