Skip to content

test(models): pin the MCP server's input rule keywords through every adapter - #283

Merged
glebedel merged 2 commits into
mainfrom
tests-rule-keywords-passthrough
Nov 19, 2026
Merged

glebedel merged 2 commits into
mainfrom
tests-rule-keywords-passthrough

Conversation

@glebedel

@glebedel glebedel commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The StackOne MCP server now advertises each connector input's validation rules as JSON Schema keywords: minLength/maxLength, format, pattern and minimum/maximum, including on array items. They appear in individual-mode tools/list and in search results.
  • The SDK already hands the served schema over unchanged, so users get these with no code change. This adds a test that pins it: it builds a tool with StackOneToolSet._create_tool, the same way fetch_tools() does, from a fixture shaped like what tools/list now serves. It then checks that to_openai_function, to_langchain and to_pydantic_ai_tool (via tool_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 check and ruff format --check are clean.
  • Checked by hand against the live APIs: OpenAI normal mode, OpenAI strict mode (with every field required, as strict mode needs) and Gemini all accept every keyword in the fixture.

🤖 Generated with Claude Code

Review gates and proof

Recorded by s2d2 on 68bec74.

gate result
forge ran
security_scan not run
codex_security not run
security_review not run
code_review ran
demo not run

…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>
@glebedel glebedel self-assigned this Nov 19, 2026
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>
@glebedel
glebedel merged commit 74aabc0 into main Nov 19, 2026
16 checks passed
@glebedel
glebedel deleted the tests-rule-keywords-passthrough branch November 19, 2026 12:49
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.

2 participants