Skip to content

feat: flag truncated results in pcm_search_cyclist and pcm_search_team - #19

Merged
mpicciolli merged 6 commits into
mainfrom
feat/search-truncation-indicator
Jul 6, 2026
Merged

feat: flag truncated results in pcm_search_cyclist and pcm_search_team#19
mpicciolli merged 6 commits into
mainfrom
feat/search-truncation-indicator

Conversation

@mpicciolli

Copy link
Copy Markdown
Collaborator

Summary

pcm_search_cyclist and pcm_search_team capped 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:

  • The SQL query now fetches one extra row (LIMIT 11) to detect whether more matches exist.
  • Both tools return a new truncated boolean in their output schema (still returning at most 10 results).
  • Tool descriptions and the README document the new flag.

Test plan

  • New test per tool: a broad single-letter search returns exactly 10 results with truncated: true.
  • Existing snapshot tests updated (they now include truncated: false for narrow searches).
  • vitest run: 12 files / 150 tests pass; biome check clean (remaining warnings pre-exist in test mocks); tsup build succeeds.

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings July 5, 2026 12:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 new truncated: boolean flag 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 truncated output 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.

Comment thread src/tools/search-team.ts
Comment thread src/tools/search-cyclist.ts
Comment thread src/tools/search-team.ts Outdated
Comment thread src/tools/search-cyclist.ts Outdated
Comment thread test/tools/search-team.test.ts
Comment thread test/tools/search-cyclist.test.ts
@mpicciolli
mpicciolli merged commit 33e8708 into main Jul 6, 2026
2 checks passed
@mpicciolli
mpicciolli deleted the feat/search-truncation-indicator branch August 6, 2026 12:29
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