MCPcopy Create free account
hub / github.com/github/gh-aw / extractBaseSafeOutputConfig

Function extractBaseSafeOutputConfig

pkg/workflow/samples_validation.go:130–147  ·  view source on GitHub ↗

extractBaseSafeOutputConfig returns the embedded BaseSafeOutputConfig of the non-nil safe-output config at SafeOutputsConfig. , or nil if the field is unset or the struct does not embed BaseSafeOutputConfig.

(config *SafeOutputsConfig, fieldName string)

Source from the content-addressed store, hash-verified

128// non-nil safe-output config at SafeOutputsConfig.<fieldName>, or nil if the
129// field is unset or the struct does not embed BaseSafeOutputConfig.
130func extractBaseSafeOutputConfig(config *SafeOutputsConfig, fieldName string) *BaseSafeOutputConfig {
131 field, ok := safeOutputPointerFieldValue(config, fieldName)
132 if !ok || field.IsNil() {
133 return nil
134 }
135 elem := field.Elem()
136 if elem.Kind() != reflect.Struct {
137 return nil
138 }
139 baseField := elem.FieldByName("BaseSafeOutputConfig")
140 if !baseField.IsValid() || !baseField.CanAddr() {
141 return nil
142 }
143 if base, ok := baseField.Addr().Interface().(*BaseSafeOutputConfig); ok {
144 return base
145 }
146 return nil
147}
148
149// validateSamplesForTool validates each sample against the named MCP tool's
150// inputSchema after stripping recognized sidecar fields.

Callers 2

collectSampleEntriesFunction · 0.85

Calls 2

IsValidMethod · 0.45

Tested by

no test coverage detected