MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / validateToolArgs

Function validateToolArgs

packages/agent-core/src/tools/args-validator.ts:81–93  ·  view source on GitHub ↗
(validator: ToolArgsValidator, args: JsonType)

Source from the content-addressed store, hash-verified

79}
80
81export function validateToolArgs(validator: ToolArgsValidator, args: JsonType): string | null {
82 const valid = validator(args);
83 if (valid) {
84 return null;
85 }
86
87 const errors = validator.errors ?? [];
88 if (errors.length === 0) {
89 return 'Tool parameter validation failed';
90 }
91
92 return errors.map((error) => formatValidationError(error)).join('; ');
93}

Callers 3

goal.test.tsFile · 0.90

Calls 1

formatValidationErrorFunction · 0.85

Tested by

no test coverage detected