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

Method CallToolsBatch

pkg/tools/bridge/bridge.go:111–131  ·  view source on GitHub ↗

CallToolsBatch 批量调用工具(顺序执行)

(ctx context.Context, calls []CallToolInput, tc *tools.ToolContext)

Source from the content-addressed store, hash-verified

109
110// CallToolsBatch 批量调用工具(顺序执行)
111func (b *ToolBridge) CallToolsBatch(ctx context.Context, calls []CallToolInput, tc *tools.ToolContext) *BatchCallResult {
112 results := make([]*CallToolResult, len(calls))
113 succeeded := 0
114 failed := 0
115
116 for i, call := range calls {
117 result, _ := b.CallTool(ctx, call.Name, call.Input, tc)
118 results[i] = result
119 if result.Success {
120 succeeded++
121 } else {
122 failed++
123 }
124 }
125
126 return &BatchCallResult{
127 Results: results,
128 Succeeded: succeeded,
129 Failed: failed,
130 }
131}
132
133// CallToolsParallel 并行调用工具
134func (b *ToolBridge) CallToolsParallel(ctx context.Context, calls []CallToolInput, tc *tools.ToolContext) *BatchCallResult {

Callers 1

TestToolBridge_BatchCallFunction · 0.95

Calls 1

CallToolMethod · 0.95

Tested by 1

TestToolBridge_BatchCallFunction · 0.76