feat: flag truncated results in pcm_search_cyclist and pcm_search_team - #19
Merged
Conversation
Both search tools capped results at 10 rows silently, so an agent could not tell whether more matches existed and the search needed narrowing. Fetch one extra row (LIMIT 11) and expose a `truncated` boolean in the output schema, mirroring the pattern already used by pcm_query_save. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR improves the UX of the MCP search tools by making previously-silent result capping explicit: pcm_search_cyclist and pcm_search_team now indicate when more matches exist beyond the returned subset, aligning with the pcm_query_save truncation pattern.
Changes:
- Update both search tools to fetch one extra row (via
LIMIT 11) and return a newtruncated: booleanflag while still returning at most 10 results. - Add targeted tests asserting that broad searches return 10 results with
truncated: true. - Update README and snapshots to document/reflect the new
truncatedoutput field.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tools/search-team.ts | Adds truncated to output schema and implements limit+1 truncation detection for team search. |
| src/tools/search-cyclist.ts | Adds truncated to output schema and implements limit+1 truncation detection for cyclist search. |
| test/tools/search-team.test.ts | Adds a test ensuring broad team search caps at 10 and flags truncation. |
| test/tools/search-cyclist.test.ts | Adds a test ensuring broad cyclist search caps at 10 and flags truncation. |
| test/tools/snapshots/search-team.test.ts.snap | Updates snapshots to include the new truncated field. |
| test/tools/snapshots/search-cyclist.test.ts.snap | Updates snapshots to include the new truncated field. |
| README.md | Documents the new truncated flag for both search tools. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…rch-truncation-indicator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pcm_search_cyclistandpcm_search_teamcapped their results at 10 rows silently: when a broad search (e.g. "Martin") matched more cyclists or teams, the caller had no way to know the list was incomplete and that the search needed narrowing.This PR makes the truncation explicit, mirroring the pattern already used by
pcm_query_save:LIMIT 11) to detect whether more matches exist.truncatedboolean in their output schema (still returning at most 10 results).Test plan
truncated: true.truncated: falsefor narrow searches).vitest run: 12 files / 150 tests pass;biome checkclean (remaining warnings pre-exist in test mocks);tsupbuild succeeds.🤖 Generated with Claude Code