CreateToolSet is used by the tools registry.
(ctx context.Context, toolset latest.Toolset, runConfig *config.RuntimeConfig)
| 29 | |
| 30 | // CreateToolSet is used by the tools registry. |
| 31 | func CreateToolSet(ctx context.Context, toolset latest.Toolset, runConfig *config.RuntimeConfig) (tools.ToolSet, error) { |
| 32 | expander := js.NewJsExpander(runConfig.EnvProvider()) |
| 33 | specURL := expander.Expand(ctx, toolset.URL, nil) |
| 34 | |
| 35 | var opts []Option |
| 36 | if toolset.Timeout > 0 { |
| 37 | opts = append(opts, WithTimeout(time.Duration(toolset.Timeout)*time.Second)) |
| 38 | } |
| 39 | if toolset.AllowPrivateIPsEnabled() { |
| 40 | opts = append(opts, WithAllowPrivateIPs(true)) |
| 41 | } |
| 42 | opts = append(opts, WithExpander(expander)) |
| 43 | |
| 44 | return New(specURL, toolset.Headers, opts...), nil |
| 45 | } |
| 46 | |
| 47 | // ToolSet generates HTTP tools from an OpenAPI specification. |
| 48 | type ToolSet struct { |
no test coverage detected