feat: Zod-validated tool responses and stable/experimental field taxonomy - #151
Conversation
…nomy Nest experimental MCP fields (degraded, decision_trace, etc.) under experimental, add response-schemas.ts for all 9 tools with runtime validation, and document the stable/experimental boundary. Fixes cppalliance#139, cppalliance#140
|
Warning Review limit reached
More reviews will be available in 3 minutes and 47 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThis PR implements stable vs experimental response field classification and Zod-backed runtime validation for all MCP tool success responses. Experimental fields (degradation diagnostics, decision traces, rerank status) are nested under an ChangesDocumentation & Deprecation Policy Foundation
Zod Response Schema Infrastructure
Tool-by-Tool Schema Integration & Experimental Field Relocation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #151 +/- ##
=======================================
Coverage ? 87.27%
=======================================
Files ? 40
Lines ? 1634
Branches ? 544
=======================================
Hits ? 1426
Misses ? 208
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai full review again |
|
✅ Action performedFull review finished. |
leostar0412
left a comment
There was a problem hiding this comment.
examples/alliance/guided-query-demo.ts and examples/alliance/README.md are stale: they still reference top-level decision_trace, which moved to experimental.decision_trace.
…onathanMLDev/pinecone-read-only-mcp-typescript into feat/response-contract-schemas
Summary
MCP success payloads now separate stable fields from experimental diagnostics under
experimental, and all nine tools validate responses with Zod before return. Schemas and helpers are exported from the package root for client-side validation.Related Issue
Changes
response-schemas.ts— 9 per-tool Zod schemas + sharedqueryResultRowSchema;QueryResponse/QueryResultRowShapederived viaz.infervalidatedJsonResponse()— runtime.parse()on success path (mirrorstoolErrorSchemaon errors)query,query_documents,guided_query— degradation fields anddecision_tracemoved toexperimental(omitted when empty)buildQueryExperimental/buildGuidedQueryExperimentalhelpersTOOLS.mdstability table,deprecation-policy.mdpromotion process,MIGRATION.mdbefore/after,CHANGELOG.mdbreaking entryresponse-schemas.test.ts+ schema alignment in all 9*.context.test.tsfilesAcceptance criteria
validatedJsonResponse@will-cppa/pinecone-read-only-mcpnpm run cigreen (246 tests)Test plan
npm run ciresponse-schemas.test.ts— valid fixtures + rejection casesexpectMatchesResponseSchemain context testsNotes for reviewers
degraded/decision_tracemust switch toexperimental.*(pre-1.0, documented in MIGRATION).guided_query.resultusesz.union([countBranch, queryResponse])— no shared discriminant key.KeywordSearchResponsere-export fromkeyword-search-tool.tskept@deprecatedfor one minor cycle.Summary by CodeRabbit
Release Notes
Breaking Changes
degraded,degradation_reason,hybrid_leg_failed,decision_trace) are now nested under anexperimentalobject in success payloadsNew Features
Documentation