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

Method handleDirectToolCall

pkg/agent/actor.go:376–404  ·  view source on GitHub ↗

handleDirectToolCall 处理直接工具调用

(ctx *actor.Context, msg *DirectToolCallMsg)

Source from the content-addressed store, hash-verified

374
375// handleDirectToolCall 处理直接工具调用
376func (a *AgentActor) handleDirectToolCall(ctx *actor.Context, msg *DirectToolCallMsg) {
377 execCtx, cancel := a.withCancellation(msg.Ctx)
378 defer cancel()
379
380 go func() {
381 result, err := a.agent.ExecuteToolDirect(execCtx, msg.ToolName, msg.Input)
382
383 response := &DirectToolResultMsg{
384 ToolName: msg.ToolName,
385 Result: result,
386 Error: err,
387 }
388
389 if err != nil && !errors.Is(err, context.Canceled) {
390 a.recordError(err)
391 }
392
393 if msg.ReplyTo != nil {
394 select {
395 case msg.ReplyTo <- response:
396 default:
397 }
398 }
399
400 if ctx.Sender != nil {
401 ctx.Reply(response)
402 }
403 }()
404}
405
406// handleBatchToolCall 处理批量工具调用
407func (a *AgentActor) handleBatchToolCall(ctx *actor.Context, msg *BatchToolCallMsg) {

Callers 1

ReceiveMethod · 0.95

Calls 5

withCancellationMethod · 0.95
recordErrorMethod · 0.95
cancelFunction · 0.85
ReplyMethod · 0.80
ExecuteToolDirectMethod · 0.45

Tested by

no test coverage detected