Skip to content

Conversation

@TJReinert
Copy link
Contributor

Summary

Add pagination and filtering capabilities to the list_repos MCP tool, enabling users to efficiently browse large repository lists.

Changes

  • Filtering: Added query parameter to filter repositories by name or displayName (case-insensitive)
  • Pagination: Added pageNumber (1-indexed, default: 1) and limit (default: 50) parameters for result pagination
  • Schema: Created listReposRequestSchema in schemas.ts for request validation with proper Zod descriptors
  • Response Info: Added pagination metadata in responses to help users navigate results (e.g., "Use pageNumber 3 to see more")
  • Documentation: Updated README with new parameters and usage examples

Motivation

Previously, the list_repos tool returned all repositories at once, which is inefficient for organizations with large repository counts. Without pagination, responses can become too large for LMs to ingest, failing or consuming unnecessary context tokens. This change allows users to:

  • Search for specific repositories by name to reduce result set
  • Paginate through results efficiently to stay within LM context budgets
  • Control response size with configurable limits
  • Get more focused, actionable results from the tool

Implementation & Improvements

These changes are implemented entirely on the MCP side since the API is fast. This approach is the least invasive version of this feature. If it is palatable to move filtering and pagination to the API level for better performance, I'm happy to implement that.

Testing

The tool has been tested with various scenarios:

  • No inputs, defaults applied (page 1, size 50)
  • Page 1 with limit=5 (returns first 5 results)
  • Page 2 with limit=5 (returns next 5 results with pagination info)
  • Out-of-range page (returns helpful message)
  • Query filtering (filters by repository name)
  • Invalid input validation (rejects pageNumber < 1)

Fixes sourcebot-dev#566

  - Add query parameter to filter repositories by name
  - Add pageNumber and limit parameters for pagination
  - Include pagination info in response when applicable
  - Add listReposRequestSchema for request validation
  - Update README with new list_repos parameters
@coderabbitai
Copy link

coderabbitai bot commented Nov 12, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@brendan-kellam brendan-kellam left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Left one comment about ordering guarantees.

I think your approach of putting pagination here instead of the API layer is a good middle-ground. It would be good to support pagination in the API layer at some point, maybe when we take the time to have a stable API surface #101 .

@brendan-kellam
Copy link
Contributor

brendan-kellam commented Nov 17, 2025

Could you also add a entry to packages/mcp/CHANGELOG.md?

@brendan-kellam brendan-kellam merged commit 9bee8c2 into sourcebot-dev:main Nov 18, 2025
5 checks passed
@brendan-kellam
Copy link
Contributor

Released in v1.0.9 - thanks for the PR!

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.

2 participants