Preserve MCP output schemas in model requests#1986
Preserve MCP output schemas in model requests#1986Genmin wants to merge 2 commits intoMCPJam:mainfrom
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✅ Files skipped from review due to trivial changes (5)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughAdds support for MCP tool output schemas across the codebase: introduces an optional Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@mcpjam-inspector/server/utils/model-request-payload.ts`:
- Around line 39-45: The current early-return for plain object schemas
incorrectly catches Zod schemas and prevents serialization; in the function
handling schema (variable name "schema") move the generic object fallback (the
branch that returns schema as Record<string, unknown>) to after the attempt to
call z.toJSONSchema(schema as z.ZodType), so first try z.toJSONSchema and return
that if it succeeds, and only if serialization fails fall back to returning the
raw object; update logic around the try/catch block referencing z.toJSONSchema
and the plain-object check to reflect this order and add a test for
outputSchema: z.object({...}).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 10128e16-4bed-4b4e-bd3e-73bede0435f2
📒 Files selected for processing (7)
.changeset/curly-tools-smile.mdmcpjam-inspector/server/utils/__tests__/model-request-payload.test.tsmcpjam-inspector/server/utils/model-request-payload.tsmcpjam-inspector/shared/model-request-payload.tssdk/src/TestAgent.tssdk/src/mcp-client-manager/tool-converters.tssdk/tests/tool-converters.test.ts
|
Addressed the CodeRabbit output schema finding. Validation:
I also tried |
2d69663 to
69d463f
Compare
69d463f to
1a73339
Compare
Summary
outputSchemadetails in model-facing tool descriptions so providers can seestructuredContentfield meaningstool.outputSchemafor the wholeCallToolResultFixes #1956.
Validation
npm run test -w @mcpjam/sdk -- tool-converters.test.tsnpm run test -w @mcpjam/inspector -- model-request-payload.test.tsnpm run typecheck -w @mcpjam/sdknpm run build -w @mcpjam/sdknpm run build:server -w @mcpjam/inspectorgit diff --check