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

Method ExecuteToolsDirect

pkg/agent/agent.go:1133–1154  ·  view source on GitHub ↗

ExecuteToolsDirect 批量直接执行工具(顺序执行)

(ctx context.Context, calls []ToolCall)

Source from the content-addressed store, hash-verified

1131
1132// ExecuteToolsDirect 批量直接执行工具(顺序执行)
1133func (a *Agent) ExecuteToolsDirect(ctx context.Context, calls []ToolCall) []ToolCallResult {
1134 results := make([]ToolCallResult, len(calls))
1135
1136 for i, call := range calls {
1137 result, err := a.ExecuteToolDirect(ctx, call.Name, call.Input)
1138 if err != nil {
1139 results[i] = ToolCallResult{
1140 Name: call.Name,
1141 Success: false,
1142 Error: err.Error(),
1143 }
1144 } else {
1145 results[i] = ToolCallResult{
1146 Name: call.Name,
1147 Success: true,
1148 Result: result,
1149 }
1150 }
1151 }
1152
1153 return results
1154}
1155
1156// ToolCall 工具调用参数
1157type ToolCall struct {

Callers 1

handleBatchToolCallMethod · 0.80

Calls 2

ExecuteToolDirectMethod · 0.95
ErrorMethod · 0.65

Tested by

no test coverage detected