feat: MCP text format v2 — XML envelopes, relevance tiers, source context (R71)#197
feat: MCP text format v2 — XML envelopes, relevance tiers, source context (R71)#197
Conversation
…text (R71) TextFormatter.swift: - brain_search: XML envelope, markers (◇ chunks, ◆ entities), relevance tiers (high/medium/low dots), source label + date + project, smart sentence-boundary content cutting - brain_entity: XML envelope, outgoing/incoming relation sections, UPPERCASE relation labels, grouped by type - KG facts: UPPERCASE labels, outgoing/incoming split - New helpers: escapeXML(), smartCutoff() for sentence boundaries SearchResult.swift: - Add contentType, sessionID fields (from existing SQL SELECT) - Add relevanceTier and sourceLabel computed properties MCPRouter.swift: - Divider between KG section and search results Before: score:28.52 imp:4 rt-9102edee- After: high-relevance | from: conversation | 2026-04-03 | project: orchestrator Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@coderabbitai review |
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughOutput formatting has been overhauled across the TextFormatter to use XML-like wrappers and structured metadata rendering. SearchResult model now includes content type and session tracking with derived relevance tier and source labels. MCPRouter integrates a separator line between knowledge graph facts and search results. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Summary
Complete redesign of MCP text output format based on R71 research spec. Same data, much better presentation.
Before → After
brain_search:
brain_entity:
Changes
<brain_search query=... tool="brain_search">/<brain_entity name=... tool="brain_entity">Test plan
swift buildcompilesCo-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
🤖 Generated with Claude Code
Note
Reformat MCP text output to use XML envelopes, relevance tiers, and source context
TextFormatter.formatSearchResultsto emit a<brain_search>XML envelope with markdown-style content, including relevance tier indicators (●●●/●●○/●○○), source labels, tags, and smart word/sentence-boundary truncation.TextFormatter.formatEntitySimpleto emit a<brain_entity>XML envelope with grouped outgoing/incoming relationships and bullet-list metadata, replacing ASCII box drawing.TextFormatter.formatKGFactsto group facts into outgoing/incoming sections with uppercased relation type labels and arrow indicators.relevanceTierandsourceLabelcomputed properties toSearchResult, and parsescontent_typeandsession_idfrom search payloads.MCPRouter.handleBrainSearch, KG facts are now separated from the<brain_search>block with a horizontal rule.Macroscope summarized b5bd9ba.
Summary by CodeRabbit
New Features