MCPcopy
hub / github.com/googleapis/mcp-toolbox / DecodeConfig

Function DecodeConfig

internal/tools/tools.go:56–66  ·  view source on GitHub ↗

DecodeConfig looks up the registered factory for the given type and uses it to decode the tool configuration.

(ctx context.Context, resourceType string, name string, decoder *yaml.Decoder)

Source from the content-addressed store, hash-verified

54// DecodeConfig looks up the registered factory for the given type and uses it
55// to decode the tool configuration.
56func DecodeConfig(ctx context.Context, resourceType string, name string, decoder *yaml.Decoder) (ToolConfig, error) {
57 factory, found := toolRegistry[resourceType]
58 if !found {
59 return nil, fmt.Errorf("%w: %q", ErrUnknownToolType, resourceType)
60 }
61 toolConfig, err := factory(ctx, name, decoder)
62 if err != nil {
63 return nil, fmt.Errorf("unable to parse tool %q as type %q: %w", name, resourceType, err)
64 }
65 return toolConfig, nil
66}
67
68type ToolConfig interface {
69 ToolConfigType() string

Callers 1

UnmarshalYAMLToolConfigFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected