Repository navigation
fix(mcp): handle null tools field in MCP server configs - #1960
Merged
Merged
Conversation
moezdil
requested review from
EItanya,
iplay88keys,
jmhbh,
peterj,
supreme-gg-gg and
yuval-k
as code owners
June 3, 2026 21:35
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR makes the tools list in MCP server configs more tolerant/optional by normalizing null to an empty list in Python and omitting empty tools fields from JSON in Go.
Changes:
- Add Pydantic
field_validatorto coercetools: nullinto[]for both HTTP and SSE MCP server configs. - Update Go JSON tags to
omitemptyfortoolsin HTTP and SSE MCP server configs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| python/packages/kagent-adk/src/kagent/adk/types.py | Coerces tools from null to [] via Pydantic validators. |
| go/api/adk/types.go | Omits tools from JSON when empty to align with optional semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
moezdil
force-pushed
the
fix/mcp-tools-null-crash
branch
2 times, most recently
from
June 4, 2026 14:27
97fa6de to
d2503c3
Compare
EItanya
previously approved these changes
Jun 5, 2026
EItanya
left a comment
Contributor
There was a problem hiding this comment.
Makes sense to me, needs to resolve conflicts now
When tools is omitted from an MCP server config, the Go side serializes it as null, which causes a pydantic ValidationError on the Python side because the field expects list[str]. Add omitempty to the Go JSON tags so null is never sent, and add a field_validator in Python to coerce null to an empty list. Fixes #1797 Signed-off-by: mesutoezdil <[email protected]>
moezdil
force-pushed
the
fix/mcp-tools-null-crash
branch
from
June 5, 2026 15:34
d2503c3 to
09434f3
Compare
6 tasks done
social4hyq
pushed a commit
to social4hyq/homebrew-core
that referenced
this pull request
Sep 20, 2026
kagent 0.9.6 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre><!-- Release notes generated using configuration in .github/release.yml at v0.9.6 --> ## What's Changed ### Features * feat(mcp): expose agents as MCP resource with change notifications by @onematchfox in kagent-dev/kagent#1856 * feat(adk): propagate parent + root context_id headers on outbound A2A calls by @Prefix in kagent-dev/kagent#1927 ### Bug Fixes * fix(compaction): preserve namespaced tool names in LLM summarizer prompt by @yashrajshuklaaa in kagent-dev/kagent#1907 * fix: preserve Ollama streaming tool calls by @andreivince in kagent-dev/kagent#1948 * fix(bedrock): preserve thinking blocks in multi-turn tool use by @mesutoezdil in kagent-dev/kagent#1873 * fix(translator): forward Anthropic config fields to model config by @mesutoezdil in kagent-dev/kagent#1962 * fix(openai): apply ReasoningEffort in applyOpenAIConfig by @mesutoezdil in kagent-dev/kagent#1959 * fix(mcp): handle null tools field in MCP server configs by @mesutoezdil in kagent-dev/kagent#1960 ### Documentation * docs(api): add field descriptions for BYO agent spec by @marians in kagent-dev/kagent#1969 ### Other Changes * Fix/1945 fix for wrong validation being triggered by @gauravshinde1729 in kagent-dev/kagent#1946 * openclaw substrate support by @peterj in kagent-dev/kagent#1939 * chore(deps): bump the npm-minor-patch group in /ui with 14 updates by @dependabot[bot] in kagent-dev/kagent#1951 * Link fixes by @kristin-kronstain-brown in kagent-dev/kagent#1950 * RemoteMCPServer TLS + companion-Secret API + plaintext egress rewrite by @iplay88keys in kagent-dev/kagent#1905 ## New Contributors * @yashrajshuklaaa made their first contribution in kagent-dev/kagent#1907 * @andreivince made their first contribution in kagent-dev/kagent#1948 * @kristin-kronstain-brown made their first contribution in kagent-dev/kagent#1950 * @Prefix made their first contribution in kagent-dev/kagent#1927 * @marians made their first contribution in kagent-dev/kagent#1969 **Full Changelog**: https://github.com/kagent-dev/kagent/compare/v0.9.5...v0.9.6</pre> <p>View the full release notes at <a href="https://github.com/kagent-dev/kagent/releases/tag/v0.9.6">https://github.com/kagent-dev/kagent/releases/tag/v0.9.6</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!10637
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.
When tools is omitted from an MCP server config, the Go side serializes it as null. This causes a pydantic ValidationError on the Python side because the field expects list[str].
Fix: add omitempty to the Go JSON tags so null is never sent, and add a field_validator in Python to coerce null to an empty list.
Fixes #1797