Skip to content

Bug: read_claude_sessions fails to resolve JSONL files by session UUID #7

@sinh-x

Description

@sinh-x

Summary

The read_claude_sessions MCP tool fails to find JSONL session files even when they exist at the expected path on disk.

Observed Behaviour

When calling read_claude_sessions with a known session UUID (e.g. 288721) and a project path, the tool returns no results or an error — despite the JSONL file existing at the expected location.

Workaround: use jq directly on the JSONL files:

jq '.' ~/.claude/projects/<project-key>/<session-uuid>.jsonl

Root Cause (suspected)

Claude Code stores JSONL session files under an internal project key derived from the working directory path:

~/.claude/projects/-home-sinh-git-repos-andafin-infrastructure-andafin-data-dashboard/<uuid>.jsonl

The path transformation replaces / with - and prepends -. The read_claude_sessions tool likely does not apply this transformation when resolving the project path to a directory key, so it looks in the wrong location.

Steps to Reproduce

  1. Have an active Claude Code session in any project directory
  2. Note the session UUID from the JSONL filename
  3. Call read_claude_sessions with session_id=<uuid> and project_path=<absolute-path>
  4. Observe: tool returns empty or error despite file existing

Expected Behaviour

Tool correctly maps project_path=/home/sinh/git-repos/andafin/... to the internal key -home-sinh-git-repos-andafin-... and finds the JSONL file.

Environment

  • Discovered: 2026-02-25 during MCP consolidation session (andafin-data-dashboard)
  • Session log reference: 2026-02-25-288721-andafin-mcp-consolidation.md
  • Claude Code version: claude-opus-4-6

Fix Suggestion

In the path resolution logic, add a transformation step:

def project_path_to_key(path: str) -> str:
    # /home/sinh/git-repos/foo → -home-sinh-git-repos-foo
    return path.replace("/", "-")

Then look up ~/.claude/projects/<key>/ for JSONL files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions