Skip to content

Commit 7cde04b

Browse files
committed
feat: #697 removed system property option to change default validation toggle
1 parent 3b63b8e commit 7cde04b

2 files changed

Lines changed: 4 additions & 19 deletions

File tree

mcp-core/src/main/java/io/modelcontextprotocol/server/McpServer.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import io.modelcontextprotocol.util.Assert;
2626
import io.modelcontextprotocol.util.DefaultMcpUriTemplateManagerFactory;
2727
import io.modelcontextprotocol.util.McpUriTemplateManagerFactory;
28-
import io.modelcontextprotocol.util.ToolInputValidator;
2928
import io.modelcontextprotocol.util.ToolNameValidator;
3029
import reactor.core.publisher.Mono;
3130

@@ -294,7 +293,7 @@ abstract class AsyncSpecification<S extends AsyncSpecification<S>> {
294293

295294
boolean strictToolNameValidation = ToolNameValidator.isStrictByDefault();
296295

297-
boolean validateToolInputs = ToolInputValidator.isEnabledByDefault();
296+
boolean validateToolInputs = true;
298297

299298
/**
300299
* The Model Context Protocol (MCP) allows servers to expose tools that can be
@@ -888,7 +887,7 @@ abstract class SyncSpecification<S extends SyncSpecification<S>> {
888887

889888
boolean strictToolNameValidation = ToolNameValidator.isStrictByDefault();
890889

891-
boolean validateToolInputs = ToolInputValidator.isEnabledByDefault();
890+
boolean validateToolInputs = true;
892891

893892
/**
894893
* The Model Context Protocol (MCP) allows servers to expose tools that can be
@@ -1431,7 +1430,7 @@ class StatelessAsyncSpecification {
14311430

14321431
boolean strictToolNameValidation = ToolNameValidator.isStrictByDefault();
14331432

1434-
boolean validateToolInputs = ToolInputValidator.isEnabledByDefault();
1433+
boolean validateToolInputs = true;
14351434

14361435
/**
14371436
* The Model Context Protocol (MCP) allows servers to expose tools that can be
@@ -1929,7 +1928,7 @@ class StatelessSyncSpecification {
19291928

19301929
boolean strictToolNameValidation = ToolNameValidator.isStrictByDefault();
19311930

1932-
boolean validateToolInputs = ToolInputValidator.isEnabledByDefault();
1931+
boolean validateToolInputs = true;
19331932

19341933
/**
19351934
* The Model Context Protocol (MCP) allows servers to expose tools that can be

mcp-core/src/main/java/io/modelcontextprotocol/util/ToolInputValidator.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,9 @@ public final class ToolInputValidator {
2424

2525
private static final Logger logger = LoggerFactory.getLogger(ToolInputValidator.class);
2626

27-
/**
28-
* System property to disable tool input validation. Set to "false" to disable.
29-
* Default is true (validation enabled).
30-
*/
31-
public static final String VALIDATE_TOOL_INPUTS_PROPERTY = "io.modelcontextprotocol.validateToolInputs";
32-
3327
private ToolInputValidator() {
3428
}
3529

36-
/**
37-
* Returns whether validation is enabled by default based on system property.
38-
* @return true if validation is enabled (default), false if disabled
39-
*/
40-
public static boolean isEnabledByDefault() {
41-
return !"false".equalsIgnoreCase(System.getProperty(VALIDATE_TOOL_INPUTS_PROPERTY));
42-
}
43-
4430
/**
4531
* Validates tool arguments against the tool's input schema.
4632
* @param tool the tool definition containing the input schema

0 commit comments

Comments
 (0)