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

Function NewStrictDecoder

internal/util/util.go:149–161  ·  view source on GitHub ↗
(v interface{})

Source from the content-addressed store, hash-verified

147}
148
149func NewStrictDecoder(v interface{}) (*yaml.Decoder, error) {
150 b, err := yaml.Marshal(v)
151 if err != nil {
152 return nil, fmt.Errorf("fail to marshal %q: %w", v, err)
153 }
154
155 dec := yaml.NewDecoder(
156 bytes.NewReader(b),
157 yaml.Strict(),
158 yaml.Validator(validator.New()),
159 )
160 return dec, nil
161}
162
163// loggerKey is the key used to store logger within context
164const loggerKey contextKey = "logger"

Callers 7

UnmarshalYAMLToolConfigFunction · 0.92
ParseParameterFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected