Class ToolInputValidator

java.lang.Object
io.modelcontextprotocol.util.ToolInputValidator

public final class ToolInputValidator extends Object
Validates tool input arguments against JSON schema.
Author:
Andrei Shakirin
  • Method Details

    • validate

      public static McpSchema.CallToolResult validate(McpSchema.Tool tool, Map<String,Object> arguments, boolean validateToolInputs, JsonSchemaValidator validator)
      Validates tool arguments against the tool's input schema.
      Parameters:
      tool - the tool definition containing the input schema
      arguments - the arguments to validate
      validateToolInputs - whether validation is enabled
      validator - the JSON schema validator (may be null)
      Returns:
      CallToolResult with isError=true if validation fails, null if valid or validation skipped