@@ -21,7 +21,7 @@ type Deps struct {
2121}
2222
2323// HandlerFunc is a function that handles a tool call.
24- type HandlerFunc [Arg , Ret any ] func (tb Deps , args Arg ) (Ret , error )
24+ type HandlerFunc [Arg , Ret any ] func (context. Context , Deps , Arg ) (Ret , error )
2525
2626type Tool [Arg , Ret any ] struct {
2727 aisdk.Tool
@@ -32,12 +32,12 @@ type Tool[Arg, Ret any] struct {
3232func (t Tool [Arg , Ret ]) Generic () Tool [any , any ] {
3333 return Tool [any , any ]{
3434 Tool : t .Tool ,
35- Handler : func (tb Deps , args any ) (any , error ) {
35+ Handler : func (ctx context. Context , tb Deps , args any ) (any , error ) {
3636 typedArg , ok := args .(Arg )
3737 if ! ok {
3838 return nil , xerrors .Errorf ("developer error: invalid argument type for tool %s" , t .Tool .Name )
3939 }
40- return t .Handler (tb , typedArg )
40+ return t .Handler (ctx , tb , typedArg )
4141 },
4242 }
4343}
@@ -165,7 +165,7 @@ func wrapAll(mw func(HandlerFunc[any, any]) HandlerFunc[any, any], tools ...Tool
165165var (
166166 // All is a list of all tools that can be used in the Coder CLI.
167167 // When you add a new tool, be sure to include it here!
168- All = wrapAll (WithRecover ,
168+ All = wrapAll (WithCleanContext , wrapAll ( WithRecover ,
169169 CreateTemplate .Generic (),
170170 CreateTemplateVersion .Generic (),
171171 CreateWorkspace .Generic (),
@@ -182,7 +182,7 @@ var (
182182 ReportTask .Generic (),
183183 UploadTarFile .Generic (),
184184 UpdateTemplateActiveVersion .Generic (),
185- )
185+ )... )
186186
187187 ReportTask = Tool [ReportTaskArgs , string ]{
188188 Tool : aisdk.Tool {
0 commit comments