hermes - 💡(How to fix) Fix Schema sanitizer should strip/rename property keys with invalid characters for strict backends [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

tools/schema_sanitizer.py sanitizes property values (bare-string types, nullable unions, type arrays, missing properties dicts, etc.) but never validates property key names. Invalid characters like $ in keys pass through untouched to the API.

Fix Action

Fixed

Code Example

tools.N.custom.input_schema.properties: Property keys should match pattern '^[a-zA-Z0-9_.-]{1,64}$'
RAW_BUFFERClick to expand / collapse

Problem

When an MCP tool exposes a parameter with a key containing characters outside [a-zA-Z0-9_.-] (e.g. $defs), strict API backends (GitHub Copilot, Anthropic) reject the entire request with:

tools.N.custom.input_schema.properties: Property keys should match pattern '^[a-zA-Z0-9_.-]{1,64}$'

This makes it impossible to use any MCP server that emits such parameter names when the provider is copilot.

Root Cause

tools/schema_sanitizer.py sanitizes property values (bare-string types, nullable unions, type arrays, missing properties dicts, etc.) but never validates property key names. Invalid characters like $ in keys pass through untouched to the API.

Reproduction

  1. Connect an MCP server that exposes a tool with a $-prefixed parameter name (e.g. ADO Pipelines MCP server has a $defs parameter on pipelines_build)
  2. Set provider to copilot (api.githubcopilot.com)
  3. Attempt any prompt that includes that tool in the schema
  4. Request fails with HTTP 400: invalid_request_body

Suggested Fix

In _sanitize_node(), after building the properties dict, strip invalid characters from keys that don't match ^[a-zA-Z0-9_.-]{1,64}$ — renaming them (e.g. $defsdefs) or dropping the property if renaming would collide or produce an empty key. Also re-prune the required array after any renames/removals.

Environment

  • Hermes version: v0.16.0 (commit 0c0a70774)
  • Provider: copilot (api.githubcopilot.com)
  • Model: claude-opus-4.7-1m-internal
  • OS: Linux

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING