(ctx context.Context, tool tools.Tool, tracker *toolCallTracker)
| 116 | } |
| 117 | |
| 118 | func 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. |
no test coverage detected