Skip to content

fix: make header names python-safe#592

Open
saurabhkoshatwar wants to merge 1 commit intogoogleapis:mainfrom
saurabhkoshatwar:skoshatwar/issue-fix-580
Open

fix: make header names python-safe#592
saurabhkoshatwar wants to merge 1 commit intogoogleapis:mainfrom
saurabhkoshatwar:skoshatwar/issue-fix-580

Conversation

@saurabhkoshatwar
Copy link

@saurabhkoshatwar saurabhkoshatwar commented Mar 14, 2026

Fixes #580

Summary

  • Allow Toolbox tools to use parameter/header names that are not valid Python identifiers (e.g. X-Application-ID).
  • Introduce a Python‑safe field name mapping so function signatures and Pydantic models stay valid while preserving the original parameter names over the wire.

Details

  • Sanitize schema parameter names into Python‑safe field names and use those in inspect.Parameter and Pydantic models.
  • Maintain a mapping from Python‑safe names back to original schema names in ToolboxTool so requests still use the exact header/parameter names defined in tools.yaml.

@anubhav756
Copy link
Contributor

/gcbrun

@anubhav756
Copy link
Contributor

Thanks for the PR @saurabhkoshatwar !

Could you please take a look at the integration test failure?

I'm also thinking if we could add any more integration/unit tests to verify this change. For instance to see if there could still be any validation failures while actually using hyphenated parameters?

@anubhav756 anubhav756 added priority: p2 Moderately-important priority. Fix may not be included in next release. help wanted labels Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p2 Moderately-important priority. Fix may not be included in next release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP Toolbox HTTP Source - Header Parameter don't allow headers with hyphen.

2 participants