diff --git a/src/tools/base.ts b/src/tools/base.ts index 1897ad1..6dad50a 100644 --- a/src/tools/base.ts +++ b/src/tools/base.ts @@ -292,7 +292,7 @@ export abstract class Tool< protected abstract _run( arg: ToolInput, options: TRunOptions | undefined, - run: GetRunContext, + run: GetRunContext, ): Promise; async getInputJsonSchema() { @@ -400,7 +400,11 @@ export class DynamicTool< name: string; description: string; inputSchema: TInputSchema; - handler: (input: TInput, options?: TRunOptions) => Promise; + handler: ( + input: TInput, + options: TRunOptions | undefined, + run: GetRunContext>, + ) => Promise; options?: TOptions; }) { validate( @@ -420,8 +424,12 @@ export class DynamicTool< this.handler = fields.handler; } - protected _run(arg: TInput, options?: TRunOptions): Promise { - return this.handler(arg, options); + protected _run( + arg: TInput, + options: TRunOptions | undefined, + run: GetRunContext>, + ): Promise { + return this.handler(arg, options, run); } createSnapshot() {