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

Function CreateToolSet

pkg/tools/builtin/openapi/openapi.go:31–45  ·  view source on GitHub ↗

CreateToolSet is used by the tools registry.

(ctx context.Context, toolset latest.Toolset, runConfig *config.RuntimeConfig)

Source from the content-addressed store, hash-verified

29
30// CreateToolSet is used by the tools registry.
31func 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.
48type ToolSet struct {

Callers 1

DefaultToolsetCreatorsFunction · 0.92

Calls 9

NewJsExpanderFunction · 0.92
EnvProviderMethod · 0.80
ExpandMethod · 0.80
DurationMethod · 0.80
WithTimeoutFunction · 0.70
WithAllowPrivateIPsFunction · 0.70
WithExpanderFunction · 0.70
NewFunction · 0.70

Tested by

no test coverage detected