Bug description
The tool input validation introduced in #873 returns with a misleading error message referencing outputSchema when validation fails. For example, the first test case in
ToolInputValidationIntegrationTests#invalidInput_withDefaultValidation_shouldReturnToolError leads to the following error message, but only tests for the presence of age in the error message substring:
Validation failed: structuredContent does not match tool outputSchema. Validation errors: [: required property 'age' not found]
Instead of referring to structuredContent and outputSchema, the error message should clearly indicate that the error is referring to the input data as otherwise it's misleading to consumers/LLMs.
Environment
MCP SDK 2.0.0-M3 (via Spring AI 2.0.0-M7)
Steps to reproduce
- Run
ToolInputValidationIntegrationTests#invalidInput_withDefaultValidation_shouldReturnToolError & inspect the produced error message.
- or create an MCP server with tool input validation enabled and call a tool with invalid input data
Expected behavior
- A concise error response stating that the listed schema validation errors refer to input parameters.
- Better assertions in the tool input validation test, not only checking for presence of a substring.
Minimal Complete Reproducible example
See steps to reproduce.
Bug description
The tool input validation introduced in #873 returns with a misleading error message referencing
outputSchemawhen validation fails. For example, the first test case inToolInputValidationIntegrationTests#invalidInput_withDefaultValidation_shouldReturnToolError leads to the following error message, but only tests for the presence of
agein the error message substring:Instead of referring to
structuredContentandoutputSchema, the error message should clearly indicate that the error is referring to the input data as otherwise it's misleading to consumers/LLMs.Environment
MCP SDK 2.0.0-M3 (via Spring AI 2.0.0-M7)
Steps to reproduce
ToolInputValidationIntegrationTests#invalidInput_withDefaultValidation_shouldReturnToolError& inspect the produced error message.Expected behavior
Minimal Complete Reproducible example
See steps to reproduce.