(raw map[string]any, schema map[string]any)
| 378 | } |
| 379 | } |
| 380 | |
| 381 | func 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 | |
| 389 | func 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 | } |
no test coverage detected