(t *testing.T)
| 80 | } |
| 81 | |
| 82 | func TestToolBridge_CallToolJSON(t *testing.T) { |
| 83 | registry := tools.NewRegistry() |
| 84 | |
| 85 | registry.Register("EchoTool", func(config map[string]any) (tools.Tool, error) { |
| 86 | return &mockTool{ |
| 87 | name: "EchoTool", |
| 88 | executeFunc: func(ctx context.Context, input map[string]any, tc *tools.ToolContext) (any, error) { |
| 89 | return input, nil |
| 90 | }, |
| 91 | }, nil |
| 92 | }) |
| 93 | |
| 94 | bridge := NewToolBridge(registry) |
| 95 | ctx := context.Background() |
| 96 | |
| 97 | result, err := bridge.CallToolJSON(ctx, "EchoTool", `{"message": "hello"}`, nil) |
| 98 | if err != nil { |
| 99 | t.Fatalf("CallToolJSON failed: %v", err) |
| 100 | } |
| 101 | |
| 102 | if !result.Success { |
| 103 | t.Errorf("expected success, got error: %s", result.Error) |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | func TestToolBridge_CallToolJSON_InvalidJSON(t *testing.T) { |
| 108 | registry := tools.NewRegistry() |
nothing calls this directly
no test coverage detected