Package io.modelcontextprotocol.util
Class ToolInputValidator
java.lang.Object
io.modelcontextprotocol.util.ToolInputValidator
Validates tool input arguments against JSON schema.
- Author:
- Andrei Shakirin
-
Method Summary
Modifier and TypeMethodDescriptionstatic McpSchema.CallToolResultvalidate(McpSchema.Tool tool, Map<String, Object> arguments, boolean validateToolInputs, JsonSchemaValidator validator) Validates tool arguments against the tool's input schema.
-
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 schemaarguments- the arguments to validatevalidateToolInputs- whether validation is enabledvalidator- the JSON schema validator (may be null)- Returns:
- CallToolResult with isError=true if validation fails, null if valid or validation skipped
-