MCPcopy Create free account
hub / github.com/53AI/53AIHub / encodeMCPReflectMap

Function encodeMCPReflectMap

api/controller/mcp_output.go:85–108  ·  view source on GitHub ↗
(v reflect.Value)

Source from the content-addressed store, hash-verified

83}
84
85func encodeMCPReflectMap(v reflect.Value) map[string]any {
86 result := make(map[string]any, v.Len())
87 iter := v.MapRange()
88 for iter.Next() {
89 key := iter.Key()
90 keyString := mapKeyToString(key)
91 if keyString == "" {
92 continue
93 }
94 value := iter.Value().Interface()
95 if isMCPIDField(keyString) {
96 if encodedValue, ok := encodeMCPIDValue(value); ok {
97 result[keyString] = encodedValue
98 continue
99 }
100 if encodedValues, ok := encodeMCPIDSlice(value); ok {
101 result[keyString] = encodedValues
102 continue
103 }
104 }
105 result[keyString] = encodeMCPValue(value)
106 }
107 return result
108}
109
110func mapKeyToString(key reflect.Value) string {
111 if !key.IsValid() {

Callers 1

encodeMCPValueFunction · 0.85

Calls 5

mapKeyToStringFunction · 0.85
isMCPIDFieldFunction · 0.85
encodeMCPIDValueFunction · 0.85
encodeMCPIDSliceFunction · 0.85
encodeMCPValueFunction · 0.85

Tested by

no test coverage detected