| 923 | } |
| 924 | |
| 925 | func TestToolSearchPrefixSyntax(t *testing.T) { |
| 926 | registry := coretools.NewToolRegistry(coretools.NewToolSearchTool()) |
| 927 | registry.Register(&deferredTestTool{BaseTool: coretools.BaseTool{Spec: coretools.ToolSpec{ |
| 928 | Name: "mcp_alpha", |
| 929 | Description: "Alpha remote tool", |
| 930 | InputPrototype: map[string]any{}, |
| 931 | ShouldDefer: true, |
| 932 | ReadOnly: coretools.BoolPtr(true), |
| 933 | }}}) |
| 934 | registry.Register(&deferredTestTool{BaseTool: coretools.BaseTool{Spec: coretools.ToolSpec{ |
| 935 | Name: "notebook_beta", |
| 936 | Description: "Beta notebook tool", |
| 937 | InputPrototype: map[string]any{}, |
| 938 | ShouldDefer: true, |
| 939 | ReadOnly: coretools.BoolPtr(true), |
| 940 | }}}) |
| 941 | |
| 942 | result := registry.Execute(context.Background(), coretools.ToolCall{ |
| 943 | ID: "search-1", Name: "tool_search", Input: map[string]any{"query": "+mcp"}, |
| 944 | }, coretools.ExecutionContext{"_registry": registry}) |
| 945 | if result.IsError || !strings.Contains(result.Content, "mcp_alpha") || strings.Contains(result.Content, "notebook_beta") { |
| 946 | t.Fatalf("unexpected prefix search result: error=%v content=%q", result.IsError, result.Content) |
| 947 | } |
| 948 | } |
| 949 | |
| 950 | func TestToolSearchSelectArgumentsUsePythonJSONDumpsFormatting(t *testing.T) { |
| 951 | registry := coretools.NewToolRegistry(coretools.NewToolSearchTool()) |