fix: mcp_tool_to_langchain parameters conversion error#191
Merged
Conversation
713a406 to
210bcbb
Compare
fb06bc8 to
c6d7800
Compare
c6d7800 to
c3b65be
Compare
cassiofariasmachado
approved these changes
Jul 6, 2026
tiagoek
added a commit
that referenced
this pull request
Jul 6, 2026
Adds the SDK Module Review skill to this repository: ## What this PR adds **20 deterministic checks** (no LLM calls in CI): - secrets, license-spdx, disclosure, hardcode, telemetry, docs, bdd, patterns, versioning + BREAKING family, commits, errors-logging, testing-depth, http-hygiene, concurrency, deps-supply, deletion-hygiene, constants, binding-shape, quality-gate-parity, pr-size **Rule tiers:** SHADOW | FLAG | BLOCK | BLOCK_LOCKED, configured in `.claude/config/rules.yaml` **BLOCK_LOCKED rules cannot be suppressed:** - SEC-* (all secrets), HC-03 (SAP-internal URL leak), DIS-06 (internal artifactory), LIC-01/02 (SPDX headers), BND-02 (BTP token URL concat), BND-05 (binding logs credentials), BREAKING-* (all breaking-change declarations) **REUSE.toml aggregate exemption** — this repo uses REUSE.toml at root, so per-file SPDX rules are baseline-exempted automatically. **Cross-language BDD parity** — module-aliases.yaml seeded with `dms ↔ documentmanagement` (Java sibling). **4 PR signals posted per run:** 1. Inline comments per finding 2. Aggregated summary comment 3. GitHub check-run (Checks tab) 4. Status label (`sdk-review: ✅ passed` / `❌ blocked` / `⚠️ flagged`) **Idempotent re-runs:** HTML markers let subsequent runs replace prior artifacts rather than duplicate them. ## Structure - `.claude/scripts/`: 20 check-*.sh + orchestrate.sh + aggregate.sh - `.claude/scripts/lib/`: 12 shared libs (2 Python AST + 10 bash) - `.claude/config/`: rules.yaml, module-aliases.yaml, baseline.json - `.github/workflows/sdk-module-review.yml`: auto-trigger on every PR - `.github/workflows/sdk-skill-isolation-check.yml`: validates sub-PRs - `docs/PR-REVIEW.md`: user-facing docs - `docs/BRANCH-PROTECTION-SETUP.md`: admin guide for required-check config - `tests/sdk-review/`: 57 bats tests + 6 fixtures (placeholder secrets, not real credentials) - `CONTRIBUTING.md`: amended — sdk-module-review is required before review ## Validation - 57/57 bats tests passing - shellcheck clean on all bash scripts - E2E on 5 real PRs (#196, #191, #192, #185 in this repo + Java jv#9): zero false positives observed - Self-test on this PR: 0 BLOCK, 0 FLAG (skill correctly skips its own files) - Flagship BND-02 finding verified on Java new-module PR (token URL concat) ## Rollout Recommended SHADOW → FLAG → BLOCK progression, 2 weeks each. See `docs/BRANCH-PROTECTION-SETUP.md`. ## Note on test fixtures `tests/sdk-review/fixtures/secrets-*.diff` contain intentional placeholder strings that match secret regexes (e.g. `AKIATESTFIXTUREXXXXX`, `eyJTESTFIXTURE...`) so the check-secrets rule can be unit-tested. These are NOT real credentials. Ref: https://jira.tools.sap/browse/AFSDK-3937
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.
Description
Fix
mcp_tool_to_langchaininagentgateway/converters.pyto respect the JSON Schema"type"declared in each MCP tool property instead of hard-coding every field asstr.Previously, all fields in the generated Pydantic args schema were typed as
str(orstr | Nonefor optional fields), regardless of the actual type ininput_schema. Thiscaused Pydantic to silently coerce non-string values — e.g.
limit=10became"10",active=Truebecame"True"— before forwarding them tocall_tool. MCP servers thatexpected native JSON types then rejected the call.
The fix adds a
_JSON_TYPE_MAPlookup that maps JSON Schema type strings to Python types(
integer→int,number→float,boolean→bool,array→list,object→dict,string→str). Properties with an absent or unrecognised"type"fall back to
Any. The user-guide is updated with a reference table for the mapping.Related Issue
Closes #190
Type of Change
How to Test
MCPToolwithintegerandbooleanproperties ininput_schema.mcp_tool_to_langchain.lc_tool.args_schema.model_fields:limitfield annotation must beint(notstr).activefield annotation must bebool | None(notstr | None).pytest tests/agentgateway/unit/test_converters.py -v— all 20 tests, including the new
TestMcpToolToLangchainTypeMappingclass, should pass.Checklist
Additional Notes
Only
mcp_tool_to_langchaininagentgateway/converters.pyis affected. No otherconverters exist in the codebase. The fix is fully backwards-compatible: tools that only
use
"string"properties continue to behave identically.