Skip to content

improvement(search): send each Search MCP result fact once - #9778

Merged
waleedlatif1 merged 1 commit into
stagingfrom
improvement/search-mcp-lean-payload
Nov 7, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
improvement/search-mcp-lean-payload

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Search MCP results sent the same fact twice, and every later turn of the client's conversation re-reads them. Each is now sent once:
    • sourceUrl dropped; citationUrl (the documented field) is the same string
    • chunkIndex dropped from search rows; it is always 0 for live results
    • sourceModifiedAt kept only when it is a different instant from sourceDate (calendar and meeting rows, where the date is the event start)
    • sourceContainerName kept only when it differs from title (a Slack message is titled by its channel)
    • read_document drops documentName and sourceUrl, which repeated title and citationUrl
  • A 30-row federated search shrinks from 63,090 to 57,873 characters (−8.3%) with no information lost
  • Knowledge MCP tool completed logs resultChars so response size per call can be tracked
  • MCP projection only; the Assistant has its own projection of the same results and is unchanged

Type of Change

  • Improvement

Testing

  • New tests in lib/knowledge/mcp/server.test.ts (a Slack row whose channel is its title and whose dates match, a calendar row whose dates and calendar differ, a read): seen failing on the old projection, passing now
  • vitest run lib/knowledge/mcp/ (48 passed), biome on changed files; type-check and audits in CI
  • Size measured by re-projecting a synthetic 30-row response built with the real projection code

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 7, 2026 8:28pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

This PR removes repeated facts from Search MCP responses.

  • Search and read results send each source fact once.
  • MCP completion logs show the returned text size.

No actionable issues were found. Runtime tests were not run during this review.

Reviews (1) · Last reviewed commit: "improvement(search): send each Search MC..." · Reviewed by Greptile

This branch was previously deployed

1 inactive deployment
Preview — 7ba05586 Deployed Nov 7, 2026 by vercel[bot]
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