MCPcopy Create free account
hub / github.com/astercloud/aster / TestToolBridge_ParallelCall

Function TestToolBridge_ParallelCall

pkg/tools/bridge/bridge_test.go:160–186  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

158}
159
160func TestToolBridge_ParallelCall(t *testing.T) {
161 registry := tools.NewRegistry()
162
163 registry.Register("SlowTool", func(config map[string]any) (tools.Tool, error) {
164 return &mockTool{
165 name: "SlowTool",
166 executeFunc: func(ctx context.Context, input map[string]any, tc *tools.ToolContext) (any, error) {
167 return map[string]any{"done": true}, nil
168 },
169 }, nil
170 })
171
172 bridge := NewToolBridge(registry)
173 ctx := context.Background()
174
175 calls := []CallToolInput{
176 {Name: "SlowTool", Input: nil},
177 {Name: "SlowTool", Input: nil},
178 {Name: "SlowTool", Input: nil},
179 }
180
181 result := bridge.CallToolsParallel(ctx, calls, nil)
182
183 if result.Succeeded != 3 {
184 t.Errorf("expected 3 succeeded, got %d", result.Succeeded)
185 }
186}
187
188func TestToolBridge_ListAvailableTools(t *testing.T) {
189 registry := tools.NewRegistry()

Callers

nothing calls this directly

Calls 4

RegisterMethod · 0.95
CallToolsParallelMethod · 0.95
NewRegistryFunction · 0.92
NewToolBridgeFunction · 0.85

Tested by

no test coverage detected