Concurrent MCP discovery + robust schema normalization for Harmony tool injection #101
+132
−100
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.
Concurrent MCP discovery + robust schema normalization for Harmony tool injection
Summary
asyncio.run
per URL).anyOf
/oneOf
/allOf
/nullable
enum
,description
,format
conversation_start_date
.Why
oneOf
/nullable
previously broke or were dropped; now they’re usable.Key changes
_normalize_schema
— deep-copy schema normalizer with extended support for common JSON Schema patterns._filter_tools
— removes tools excluded from prompts with safe annotation checks.gather_servers
— fetches all MCP servers concurrently.build_harmony_system_content
— cleanly constructsSystemContent
with all discovered tools.datetime.now(timezone.utc)
.system_message
).rendered_system_text
.Before / After
Before
anyOf
support;oneOf
/nullable
unsupported.After
asyncio.gather
.rendered_system_text
output.Tests
Unit (new)
_normalize_schema
with:anyOf: [{"type":"string"},{"type":"null"}]
→type: ["string"]
oneOf
→ flattenedtype
listallOf
simple mergesnullable: true
→type
includes"null"
properties
/items
_filter_tools
respectsannotations.include_in_prompt
Manual (local)
browser
andpython
MCP servers at:8001
/:8000
.oneOf
andenum
; ensure it appears correctly.Rollout / Risk
allOf
merges are naive — logged as warnings.Follow-ups
MCP_SSE_URLS
) andREASONING_EFFORT
.jsonschema
orpydantic
.Reviewer checklist
asyncio.run
call.SystemContent
.