@@ -46,8 +46,17 @@ func (c *codeModeTool) Instructions() string {
4646 return ""
4747}
4848
49+ func isExcludedTool (tool tools.Tool ) bool {
50+ // TODO(dga): make this more robust. It really a temporary hack to exclude the todo tools.
51+ // See #514
52+ return strings .Contains (tool .Name , "_todo" )
53+ }
54+
4955func (c * codeModeTool ) Tools (ctx context.Context ) ([]tools.Tool , error ) {
50- var functionsDoc []string
56+ var (
57+ functionsDoc []string
58+ excludedTools []tools.Tool
59+ )
5160
5261 for _ , toolset := range c .toolsets {
5362 allTools , err := toolset .Tools (ctx )
@@ -56,11 +65,15 @@ func (c *codeModeTool) Tools(ctx context.Context) ([]tools.Tool, error) {
5665 }
5766
5867 for _ , tool := range allTools {
59- functionsDoc = append (functionsDoc , toolToJsDoc (tool ))
68+ if isExcludedTool (tool ) {
69+ excludedTools = append (excludedTools , tool )
70+ } else {
71+ functionsDoc = append (functionsDoc , toolToJsDoc (tool ))
72+ }
6073 }
6174 }
6275
63- return []tools.Tool {{
76+ allTools := []tools.Tool {{
6477 Name : "run_tools_with_javascript" ,
6578 Description : prompt + strings .Join (functionsDoc , "\n " ),
6679 Parameters : tools .MustSchemaFor [RunToolsWithJavascriptArgs ](),
@@ -88,7 +101,11 @@ func (c *codeModeTool) Tools(ctx context.Context) ([]tools.Tool, error) {
88101 Annotations : tools.ToolAnnotations {
89102 Title : "Run tools with Javascript" ,
90103 },
91- }}, nil
104+ }}
105+
106+ allTools = append (allTools , excludedTools ... )
107+
108+ return allTools , nil
92109}
93110
94111func (c * codeModeTool ) Start (ctx context.Context ) error {
0 commit comments