MCPcopy
hub / github.com/docker/docker-agent / callTool

Function callTool

pkg/tools/codemode/exec.go:118–135  ·  view source on GitHub ↗
(ctx context.Context, tool tools.Tool, tracker *toolCallTracker)

Source from the content-addressed store, hash-verified

116}
117
118func callTool(ctx context.Context, tool tools.Tool, tracker *toolCallTracker) func(args map[string]any) (string, error) {
119 return func(args map[string]any) (string, error) {
120 output, filtered, err := invokeTool(ctx, tool, args)
121
122 info := ToolCallInfo{
123 Name: tool.Name,
124 Arguments: filtered,
125 }
126 if err != nil {
127 info.Error = err.Error()
128 } else {
129 info.Result = output
130 }
131 tracker.record(info)
132
133 return output, err
134 }
135}
136
137// invokeTool calls a single tool handler, filtering out nil optional arguments.
138// It returns the output, the filtered arguments actually sent, and any error.

Callers 1

runJavascriptMethod · 0.70

Calls 3

invokeToolFunction · 0.85
ErrorMethod · 0.45
recordMethod · 0.45

Tested by

no test coverage detected