Skip to main content
Glama

get_session

Read a Claude Code session's current state, pending requests, tool-call counts, and git status so you can inspect progress or decide whether to reply, wait, or stop.

Instructions

Read one session. phase is working, needs-input (answer what pending lists), done (reply is the final text), interrupted (the turn stopped with no final reply), failed, stopped, idle, or unknown. Also returns the title, the prompt, tool-call counts, pending requests, and git (branch, head, ahead, dirty, pushed) read at call time. To wait for a change, call wait_session. detail full adds the turn list, every step, the run record, and the session card.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "sessionId": "<sessionId>"
    },
    "name": "get_session"
  }
}

Input Schema

NameRequiredDescriptionDefault
detailNo
sessionIdYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations at all, the description carries the full load and does well: it discloses the returned fields (title, prompt, tool-call counts, pending requests, git branch/head/ahead/dirty/pushed) and crucially notes git is 'read at call time', flagging snapshot semantics. It also describes cost/volume differences via the detail enum and explains what each phase means. It omits failure behavior (e.g., unknown sessionId) and makes read-only status only implicit in 'Read'.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core action and the wait_session handoff are front-loaded, and the return payload follows in a single dense clause. The long phase enumeration earns its place because the phase values drive what the agent does next, though it could be a list rather than a run-on sentence.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema and no annotations, so the description is the only source of return-value and safety information; it covers the payload and the detail switch reasonably well. Gaps remain around sessionId semantics, not-found/error behavior, and explicit confirmation that the call is non-mutating.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it partly does: 'detail full adds the turn list, every step, the run record, and the session card' explains the payoff of the enum value, implying brief is the lighter default. The required sessionId is left entirely unexplained (format, where it comes from), leaving one of two parameters undocumented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb+resource ('Read one session') that separates it from the multi-session list_sessions sibling, and enumerates the phase states so the agent knows exactly what domain concept it is reading. The closing clause routes the waiting case to wait_session, so the tool's identity is unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit alternative for one adjacent need ('To wait for a change, call wait_session'), which is genuine when-to-use routing. It also tells the agent what to do per phase ('needs-input (answer what pending lists)', 'done (reply is the final text)'). It stops short of stating when to prefer list_sessions or how to obtain a sessionId, so it is clear but not exhaustive.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.