Skip to content

improvement(search): return 30 previews by default for a Search MCP query across every source - #9242

Merged
waleedlatif1 merged 2 commits into
stagingfrom
improvement/search-mcp-federated-topk
Oct 20, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
improvement/search-mcp-federated-topk

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Search MCP: a query across every source (no source, nativeQueries, or date sortBy) that sets no topK now returns up to 30 previews instead of 20. Single-source searches, native queries, and date-sorted listings keep 20; an explicit topK is unchanged
  • A federated search shares one list among every connected source, so at 20 the passage that answers the question was often cut; at 30 the assistant gets it without a follow-up search
  • Split the assistant search input into its fields and an exported refinement so the MCP schema can make topK optional (the MCP SDK applies schema defaults before the handler, and zod 4 can't make a field optional on a refined schema). The assistant tool's generated catalog is byte-identical
  • Search tab and the Sim assistant tool are unchanged

Type of Change

  • Improvement

Testing

  • Two interleaved A/B runs of a 12-question assistant benchmark against live sources through a proxy reproducing the server merge, judged per answer: overall +2.9 [95% CI +1.1, +4.6] and +1.0 [−0.6, +2.5]; correctness +4.2 / +1.9, completeness +4.4 / +1.8. The two hardest questions improved 11–15 points in both runs; no question regressed by more than 5. Cost: about 2 s more and ~25% more input tokens per answer
  • New server.test.ts cases cover the default per search shape, and server.protocol.test.ts checks it through the real MCP SDK; both fail on the previous code
  • vitest on lib/knowledge/mcp, mothership-assistant-tools.test.ts, lib/mothership/tools/server/knowledge (68 passed); mship-tools:generate output identical before/after; biome lint

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)

@vercel

vercel Bot commented Oct 20, 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 Oct 20, 2026 7:53am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Search MCP now defaults to 30 previews for cross-source text searches, including explicit sortBy: 'relevance'. Scoped searches, native queries, and date-sorted listings keep 20; explicit topK stays unchanged.

  • Search MCP returns more previews for plain searches across every source.

Reviews (2) · Last reviewed commit: "improvement(search): treat relevance sor..." · Reviewed by Greptile

Comment thread apps/sim/lib/knowledge/mcp/server.test.ts

@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.

All reported issues were addressed across 4 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/api/contracts/knowledge/mcp.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@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 5 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

@waleedlatif1
waleedlatif1 merged commit 22e7b18 into staging Oct 20, 2026
55 checks passed

This branch was previously deployed

1 inactive deployment
Preview — 1fa1b861 Deployed Oct 20, 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