Get SessionID within Claude Code

Status Fixed / completed
Maintainer reply None cached
Activity 9 comments · opened Jun 12, 2025 · closed Dec 8, 2025

I'm just wondering what's the best way would be to access the currently active sessionid from within Claude Code itself. By just prompting there doesn't seem to be a way, so I was thinking of having a MCP server - but not sure how to identify the currently active session. Ideas?

use-case: I want to correlate the open telemetry metrics which capture the sessionid, with some other tools for cost tracking and simply out of curiosity.

View original on GitHub ↗

This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗