[BUG] list_sessions/search_session_transcripts MCP tools silently cap at 20 results, ignoring limit
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet (related but distinct: #59736 covers sessions missing from the Desktop UI after restart on Windows — a different mechanism than the silent result-cap described here)
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
The Desktop app's session-management MCP tools (mcp__ccd_session_mgmt__list_sessions and mcp__ccd_session_mgmt__search_session_transcripts) silently cap results at 20, regardless of the requested limit, and with no field indicating the results were truncated.
list_sessionswithlimit: 5correctly returns 5 results.list_sessionswithlimit: 100andlimit: 300both return the exact same 20 results (identical sessions, identical order — the 20 most-recently-active).- In one project directory alone (
~/.claude/projects/<encoded-project-path>/) there are 184 session transcript.jsonlfiles on disk; 266 total across all projects. None of that is reflected in the tool output or any truncation flag. search_session_transcriptsappears to search over the same capped/recency-limited set rather than the full transcript history: searching for a distinctive string known to exist verbatim inside an older session's transcript returned "No matching sessions found," even though the string is present on disk in that session's.jsonlfile. The session simply fell outside the ~20 most-recently-active window.
Net effect: any session more than about 20-sessions-old (which in an actively used repo can be just a few days) becomes effectively unfindable through either tool, with no indication to the caller (human or agent) that anything was omitted.
What Should Happen?
list_sessionsshould honor the requestedlimitup to some documented maximum, or the response should include an explicit indicator (e.g.hasMore: true/totalCount) when results are truncated.search_session_transcriptsshould perform full-text search across all available transcripts (or at minimum all non-archived + archived ones within the store), not just the N most recently active sessions.
Steps to Reproduce
- In a project directory with more than 20 historical Claude Code sessions (check via
ls ~/.claude/projects/<encoded-project-path>/*.jsonl | wc -l), call thelist_sessionsMCP tool withlimit: 300, include_archived: true. - Observe the response contains exactly 20 sessions, sorted by most-recent activity, not up to 300.
- Re-run with
limit: 5— observe it correctly returns 5, confirming the parameter is read but capped somewhere above 20. - Pick a session older than the 20th-most-recent (confirm via its
.jsonlfile'stimestampfields) that contains a distinctive string in its transcript content (e.g. a keyword inside a file written via theWritetool). - Call
search_session_transcriptswith that distinctive string as the query. - Observe "No matching sessions found," despite the string being present verbatim in that session's on-disk transcript.
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Claude Code Version
2.1.216 (Claude Code) — Desktop app version 1.22209.3, bundled claude-code 2.1.215 (per running process)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
Related: #59736 documents a related but mechanically different symptom (Desktop-created sessions vanish from the UI after restart, on Windows, with entrypoint: claude-desktop-3p). This report's repro is restart-independent and reproducible purely via the MCP tool calls above, on macOS.