@@ -348,20 +348,11 @@ function implementTool<I extends z.ZodTypeAny, O extends z.ZodTypeAny>(
348348 "The 'tool.reply' method is part of the 'interrupts' beta feature."
349349 ) ;
350350 }
351- parseSchema ( responseData , {
351+ responseData = parseSchema ( responseData , {
352352 jsonSchema : config . outputJsonSchema ,
353353 schema : config . outputSchema ,
354354 } ) ;
355- return {
356- toolResponse : stripUndefinedProps ( {
357- name : interrupt . toolRequest . name ,
358- ref : interrupt . toolRequest . ref ,
359- output : responseData ,
360- } ) ,
361- metadata : {
362- interruptResponse : options ?. metadata || true ,
363- } ,
364- } ;
355+ return respondTool ( interrupt , responseData , options ) ;
365356 } ;
366357
367358 ( a as ToolAction < I , O > ) . restart = ( interrupt , resumedMetadata , options ) => {
@@ -379,19 +370,7 @@ function implementTool<I extends z.ZodTypeAny, O extends z.ZodTypeAny>(
379370 jsonSchema : config . inputJsonSchema ,
380371 } ) ;
381372 }
382- return {
383- toolRequest : stripUndefinedProps ( {
384- name : interrupt . toolRequest . name ,
385- ref : interrupt . toolRequest . ref ,
386- input : replaceInput || interrupt . toolRequest . input ,
387- } ) ,
388- metadata : stripUndefinedProps ( {
389- ...interrupt . metadata ,
390- resumed : resumedMetadata || true ,
391- // annotate the original input if replacing it
392- replacedInput : replaceInput ? interrupt . toolRequest . input : undefined ,
393- } ) ,
394- } ;
373+ return restartTool ( interrupt , resumedMetadata , { replaceInput } ) ;
395374 } ;
396375}
397376
0 commit comments