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

Function LookupString

pkg/typeutil/convert.go:169–185  ·  view source on GitHub ↗

LookupString extracts a string value from m by key.

(m map[string]any, key string)

Source from the content-addressed store, hash-verified

167
168// LookupString extracts a string value from m by key.
169func LookupString(m map[string]any, key string) (string, bool) {
170 if m == nil {
171 return "", false
172 }
173
174 value, ok := m[key]
175 if !ok {
176 return "", false
177 }
178
179 result, ok := value.(string)
180 if !ok {
181 return "", false
182 }
183
184 return result, true
185}
186
187// LookupStringPath extracts a nested string value from m by path.
188// It returns ("", false) if any step in the path is missing or has an invalid type.

Callers 4

processMCPFailureEntryFunction · 0.92
TestLookupStringFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestLookupStringFunction · 0.68