Skip to content

fix(mcp): emit properties:{} in list_agents inputSchema (#1889)#1892

Open
pboers1988 wants to merge 2 commits into
kagent-dev:mainfrom
pboers1988:fix/list-agents-input-schema-1889
Open

fix(mcp): emit properties:{} in list_agents inputSchema (#1889)#1892
pboers1988 wants to merge 2 commits into
kagent-dev:mainfrom
pboers1988:fix/list-agents-input-schema-1889

Conversation

@pboers1988
Copy link
Copy Markdown

Summary

  • The list_agents MCP tool was advertising inputSchema: {type: "object", additionalProperties: false} — no properties key. OpenAI strict-mode clients (e.g. LibreChat via Agentgateway) reject this with 400 Invalid schema for function 'list_agents_mcp_<server>': object schema missing properties.
  • Set Tool.InputSchema explicitly so the serialized schema is {type: "object", properties: {}, additionalProperties: false}, matching what invoke_agent (and OpenAI strict mode) expect.
  • Added a unit test that boots the handler with an in-memory MCP transport and asserts the schema shape — regression coverage that does not require a cluster.

Fixes #1889.

Test plan

  • go test ./core/internal/mcp/... passes locally
  • CI go test passes
  • CI go test ./core/test/e2e/... (existing e2e) still passes
  • Manual MCP tools/list against a local controller shows "properties": {} on list_agents

Copilot AI review requested due to automatic review settings May 19, 2026 08:24
@github-actions github-actions Bot added the bug Something isn't working label May 19, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_agents MCP tool so it serializes with "properties": {} and keeps additionalProperties: false.
  • Add a unit test that starts an in-memory MCP server/client and asserts the list_agents schema 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.

Comment thread go/core/internal/mcp/mcp_handler.go Outdated
Comment thread go/core/internal/mcp/mcp_handler_test.go
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>
@pboers1988 pboers1988 force-pushed the fix/list-agents-input-schema-1889 branch from aaac90a to db2ce7c Compare May 19, 2026 09:03
@pboers1988 pboers1988 requested a review from Copilot May 19, 2026 10:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] list_agents MCP tool violates OpenAI strict mode (object type without properties)

2 participants