For framework authors
Where it fits
Section titled “Where it fits”
flowchart LR
A["MCP tools/list"] --> B["normalize_tools(tools, target)"]
B --> C["to_sdk_payload() -> Model API"]
C -->|"Model tool call"| D["denormalize_args(tool, model_args)"]
D --> E["MCP tools/call"]
Recommendations
Section titled “Recommendations”- Normalize once per server toolset and target, and cache the result.
ToolsetResult.to_dict()andNormalizedTool.from_dict()round-trip. EachNormalizedToolcarries afingerprintcovering the original tool, the library version, the rules version and the target.denormalize_argsrefuses a reverse map whose fingerprint orrules_versiondoes not match (ReverseMismatchError), so a stale cache fails loudly instead of mistranslating. - Re-normalize when the server sends
notifications/tools/list_changed, or after upgradingmcp-schema-bridge. - Always call
denormalize_argsbeforetools/call, even for targets that look like pass-through. It is cheap and correct when there is nothing to undo. - Show the report to users.
lossyentries mean the model may send values the server rejects. The server still validates; the report tells you why a call might fail.fataltools are inToolsetResult.rejected. - Strict modes:
- Pass
NormalizeOptions(strict_fallback=True)to keep tools that cannot be strict, demoted to the non-strict sibling. - For
anthropic-strict, passreserved_budget=Budget(...)if your request also uses strict tools or an output schema of your own.
- Pass
- Thread safety: all functions are pure, and rules are loaded once and cached read-only. They are safe to call concurrently.
- Opt-in repairs:
denormalize_args(..., repairs={"int_from_integral_float", "enum_case_insensitive"})fixes two common model quirks. Repairs are applied only when unambiguous and always reported.
See the API & CLI reference for full signatures of NormalizeOptions, Budget, ReverseMismatchError, and denormalize_args.
Stability
Section titled “Stability”- Before 1.0, a minor release can change normalized output (see PLAN.md §10.1). Rules changes are listed under “Provider rule updates” in the changelog.
rules_versionis stamped into every report and reverse map.