fix(mcp): emit properties:{} in list_agents inputSchema (#1889)#1892
Open
pboers1988 wants to merge 2 commits into
Open
fix(mcp): emit properties:{} in list_agents inputSchema (#1889)#1892pboers1988 wants to merge 2 commits into
pboers1988 wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes MCP list_agents tool schema compatibility with OpenAI strict-mode clients by ensuring the advertised inputSchema for a no-arg tool includes an explicit "properties": {} field, and adds a regression test using an in-memory MCP transport.
Changes:
- Set an explicit JSON Schema on the
list_agentsMCP tool so it serializes with"properties": {}and keepsadditionalProperties: false. - Add a unit test that starts an in-memory MCP server/client and asserts the
list_agentsschema shape. - Expose the underlying MCP server from
MCPHandler(currently used by the new test).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| go/core/internal/mcp/mcp_handler.go | Explicitly defines list_agents input schema and adds a server accessor used by tests. |
| go/core/internal/mcp/mcp_handler_test.go | Adds regression test verifying list_agents inputSchema includes properties: {} and additionalProperties: false. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…t-dev#1889) Signed-off-by: Peter Boers <peter.boers@surf.nl>
Empty input struct reflection produced inputSchema without a properties
key, which OpenAI strict mode rejects. Set InputSchema explicitly so the
serialized schema is {type:object, properties:{}, additionalProperties:false}.
Fixes kagent-dev#1889
Signed-off-by: Peter Boers <peter.boers@surf.nl>
aaac90a to
db2ce7c
Compare
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.
Summary
list_agentsMCP tool was advertisinginputSchema: {type: "object", additionalProperties: false}— nopropertieskey. OpenAI strict-mode clients (e.g. LibreChat via Agentgateway) reject this with400 Invalid schema for function 'list_agents_mcp_<server>': object schema missing properties.Tool.InputSchemaexplicitly so the serialized schema is{type: "object", properties: {}, additionalProperties: false}, matching whatinvoke_agent(and OpenAI strict mode) expect.Fixes #1889.
Test plan
go test ./core/internal/mcp/...passes locallygo testpassesgo test ./core/test/e2e/...(existing e2e) still passestools/listagainst a local controller shows"properties": {}onlist_agents