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

Method DecodeInput

tools/mcp.go:44–59  ·  view source on GitHub ↗
(raw map[string]any)

Source from the content-addressed store, hash-verified

42 ToolName: toolName,
43 RawSchema: rawSchema,
44 }
45}
46
47func (t *MCPDynamicTool) DecodeInput(raw map[string]any) (any, error) {
48 schema := BuildMCPInputSchema(t.ToolName, t.RawSchema)
49 normalized := coerceMCPInputForSchema(raw, schema)
50 compiler := jsonschemavalidator.NewCompiler()
51 const schemaURL = "lumina://mcp-input.schema.json"
52 if err := compiler.AddResource(schemaURL, schema); err != nil {
53 return nil, err
54 }
55 compiled, err := compiler.Compile(schemaURL)
56 if err != nil {
57 return nil, err
58 }
59 if err := compiled.Validate(normalized); err != nil {
60 return nil, err
61 }
62 return filterMCPInputForModelDump(normalized, t.RawSchema), nil

Calls 3

BuildMCPInputSchemaFunction · 0.85
ValidateMethod · 0.80