Repository navigation
test(models): pin the MCP server's input rule keywords through every adapter - #283
Merged
Merged
Conversation
…adapter The MCP server now advertises each connector input's validation rules as JSON Schema keywords (minLength/maxLength, format, pattern, minimum/maximum, also on array items). The adapters already hand the served schema over verbatim; this builds a tool the way fetch_tools() does and pins that to_openai_function, to_langchain and to_pydantic_ai_tool each keep those keywords. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com>
Review of the first commit: - compare the adapters' whole parameters object, so required and type are pinned too; - build the tool from a deep copy, so an adapter that edited the served schema in place could not also edit the expectation and pass; - read pydantic-ai's public tool_def.parameters_json_schema, what it sends the model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
minLength/maxLength,format,patternandminimum/maximum, including on array items. They appear in individual-modetools/listand in search results.StackOneToolSet._create_tool, the same wayfetch_tools()does, from a fixture shaped like whattools/listnow serves. It then checks thatto_openai_function,to_langchainandto_pydantic_ai_tool(viatool_def.parameters_json_schema) each hand over the whole served schema unchanged. The tool is built from a copy of the schema, so an adapter that edited it in place would still fail the test.Test plan
uv run pytest tests/test_models.py: 61 pass, including the 3 new cases.ruff checkandruff format --checkare clean.🤖 Generated with Claude Code
Review gates and proof
Recorded by s2d2 on
68bec74.