MCPcopy Create free account
hub / github.com/docker/docker-agent / buildTools

Method buildTools

pkg/tools/builtin/openapi/openapi.go:167–183  ·  view source on GitHub ↗

buildTools converts an OpenAPI spec into a list of tools.

(spec *v3.Document)

Source from the content-addressed store, hash-verified

165
166// buildTools converts an OpenAPI spec into a list of tools.
167func (t *ToolSet) buildTools(spec *v3.Document) ([]tools.Tool, error) {
168 baseURL, err := t.resolveBaseURL(spec)
169 if err != nil {
170 return nil, err
171 }
172
173 var result []tools.Tool
174 if spec.Paths != nil && spec.Paths.PathItems != nil {
175 for path, pathItem := range spec.Paths.PathItems.FromOldest() {
176 for method, op := range pathOperations(pathItem) {
177 result = append(result, t.operationToTool(baseURL, path, method, op))
178 }
179 }
180 }
181
182 return result, nil
183}
184
185// pathOperations returns all non-nil operations for a path item.
186func pathOperations(item *v3.PathItem) map[string]*v3.Operation {

Callers 1

ToolsMethod · 0.95

Implementers 15

StartableToolSetpkg/tools/startable.go
fakeToolSetpkg/tools/named_test.go
stubDescriberpkg/tools/startable_test.go
stubToolSetpkg/tools/startable_test.go
flappyToolSetpkg/tools/startable_test.go
listFlappyToolSetpkg/tools/startable_test.go
reportingToolSetpkg/tools/startable_test.go
reportingStartOnlyToolSetpkg/tools/startable_test.go
recoveryFailingToolSetpkg/tools/startable_test.go
codeModeToolpkg/tools/codemode/codemode.go
testToolSetpkg/tools/codemode/codemode_test.go
Toolsetpkg/tools/a2a/a2a.go

Calls 3

resolveBaseURLMethod · 0.95
operationToToolMethod · 0.95
pathOperationsFunction · 0.85

Tested by

no test coverage detected