fix: prevent Tool.define() wrapper accumulation on object-defined tools (#16952)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Juan Pablo Carranza Hurtado
2026-04-02 22:09:53 -04:00
committed by GitHub
co-authored by Claude Opus 4.6
parent eb6f1dada8
commit 81d3ac3bf0
2 changed files with 109 additions and 1 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ export namespace Tool {
return {
id,
init: async (initCtx) => {
const toolInfo = init instanceof Function ? await init(initCtx) : init
const toolInfo = init instanceof Function ? await init(initCtx) : { ...init }
const execute = toolInfo.execute
toolInfo.execute = async (args, ctx) => {
try {