Skip to content

fix(agent-runtime): preserve MCP tool schema properties - #921

Open
santhiprakash wants to merge 2 commits into
CodebuffAI:mainfrom
santhiprakash:fix/mcp-tool-schema-properties
Open

fix(agent-runtime): preserve MCP tool schema properties#921
santhiprakash wants to merge 2 commits into
CodebuffAI:mainfrom
santhiprakash:fix/mcp-tool-schema-properties

Conversation

@santhiprakash

Copy link
Copy Markdown

Problem
MCP tools registered through the runtime could lose nested JSON Schema details like properties before they reached the model-facing tool definition. That breaks parameterized tools such as marionette__connect from issue #912.

Triage / Root cause
packages/agent-runtime/src/tools/prompts.ts was round-tripping additional tool definitions through Zod and then re-emitting a sanitized schema. That conversion path was unnecessary for MCP tools and could discard schema shape that callers already supplied.

Fix

  • Keep the original MCP JSON Schema object on the tool definition so nested fields survive registration unchanged.
  • Continue using Zod conversion only for description generation.
  • Add a regression test that asserts properties.uri survives getToolSet().

Verification

  • /home/ubuntu/.bun/bin/bun test packages/agent-runtime/src/__tests__/prompts-schema-handling.test.ts
  • Result: pass (16 tests passed).

Notes / Risks

  • I verified this against current upstream/main with the required preflight script before editing.
  • The worktree had unrelated pre-existing edits in sdk/src/tools/run-terminal-command.ts and sdk/src/__tests__/run-terminal-command.test.ts; I left those untouched.
  • No AI co-author trailer included.

Model Used

  • gpt-5.4-mini

Checklist

  • Current upstream verified
  • Duplicate PR check passed
  • Targeted regression test passed
  • Commit authored as Santhi Prakash

Problem: README.md links to evals/README.md, which does not exist.

Fix: point the 'our evals' link to evals/buffbench/README.md, the existing evaluation documentation.

Verification: confirmed with a local markdown link scan that only the evals/README.md link is broken, and 'ls -l evals/buffbench/README.md' confirms the target exists.
- Problem: MCP tool definitions were being normalized through Zod, which could drop nested JSON Schema details like properties before registration.
- Fix: keep the original MCP JSON Schema object on the tool definition and add a regression test that verifies properties.uri survives getToolSet().
- Verification: /home/ubuntu/.bun/bin/bun test packages/agent-runtime/src/__tests__/prompts-schema-handling.test.ts (pass).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant