MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / filterMCPInputForModelDump

Function filterMCPInputForModelDump

tools/mcp.go:380–395  ·  view source on GitHub ↗
(raw map[string]any, schema map[string]any)

Source from the content-addressed store, hash-verified

378 }
379}
380
381func coerceMCPInputForSchema(raw map[string]any, schema map[string]any) map[string]any {
382 coerced, ok := coerceMCPValueForSchema(raw, schema, schema).(map[string]any)
383 if !ok || coerced == nil {
384 return raw
385 }
386 return coerced
387}
388
389func coerceMCPValueForSchema(value any, schema map[string]any, root map[string]any) any {
390 if value == nil || len(schema) == 0 {
391 return value
392 }
393 if ref, _ := schema["$ref"].(string); ref != "" {
394 if resolved := resolveMCPRef(root, ref); len(resolved) > 0 {
395 return coerceMCPValueForSchema(value, resolved, root)
396 }
397 return value
398 }

Callers 2

DecodeInputMethod · 0.85

Calls 2

mapFromAnyFunction · 0.70

Tested by

no test coverage detected