Skip to content

perf(client): cache compiled jsonschema validator per tool output schema Fixes #3133#3157

Open
SpiliosDimakopoulos wants to merge 1 commit into
modelcontextprotocol:mainfrom
SpiliosDimakopoulos:cache-tool-output-validator
Open

perf(client): cache compiled jsonschema validator per tool output schema Fixes #3133#3157
SpiliosDimakopoulos wants to merge 1 commit into
modelcontextprotocol:mainfrom
SpiliosDimakopoulos:cache-tool-output-validator

Conversation

@SpiliosDimakopoulos

Copy link
Copy Markdown

No description provided.

validate_tool_result() called jsonschema.validate() on every tools/call,
which rebuilds the validator class, re-checks the schema, and re-crawls
its \ each time — even though a tool's output schema doesn't change
between calls. Cache the compiled validator per tool name instead, and
invalidate the cache when list_tools() reports a changed schema for that
tool. Error message selection (best_match) is unchanged.

Fixes modelcontextprotocol#3133

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant