Skip to main content
Glama

get_code_session

Retrieve a coding session by ID to inspect user turns, files touched, and per-session summaries; page long sessions or open a turn window to read surrounding context.

Instructions

Retrieve a specific coding session by ID (a memory_search record's session_id, a list_recent_conversations code row's id): its user-spine turns (what the human asked/decided/corrected), files touched, and per-session summary. To read the turns around a record, pass its session_id as id and its turn_idx as turn: you get only turns turn-window..turn+window (window default 8, max 40; max_chars default 12000 here) with focus {turn, window, first_idx, last_idx, total_turns}; prev_start/next_start, passed as start (without turn), read the turns before/after; start reads forward from there with the default 60000 chars. Whole-session paging below is the fallback. Long sessions come in parts: each call returns the session metadata and summary plus whole turns from start up to about max_chars of turn text (default 60000), with total_turns, total_chars, returned {start, end (exclusive)} and next_start. files_touched is on the first part only (up to 200 paths; files_touched_total and files_touched_omitted give the rest's count). When next_start is not null, call get_code_session again with the same id and start=next_start until next_start is null to read every turn. The first part also lists sub_agents: the sub-agent sessions this session spawned (id, agent_type, description, started_at, ended_at, turn_count, brief = first 160 chars of the task it was given; at most 200, sub_agents_total gives the full count); open one with get_code_session id=. When this session is itself a sub-agent, parent_session_id is the id of the session that spawned it. Use it to read what was actually said; use session_summary for a short threaded overview of the same session. Results are dated records of what sessions did, not the current state of a PR or issue; check that live.

Input Schema

NameRequiredDescriptionDefault
idYesCode session ID; a unique prefix of ≥ 8 chars also works
turnNoOpen the session at this turn (a memory_search record's turn_idx): only the turns within ±window of it are returned. Omit to page the whole session from start.
startNoIndex of the first turn to return (default 0). Pass the previous call's next_start to continue. Ignored when turn is given (turn wins over start).
windowNoWith turn: how many turns either side to return (default 8, clamped to 1–40).
max_charsNoApproximate turn-text budget for this part, in characters (default 60000, or 12000 with turn; clamped to 5000–200000). A single turn larger than this is returned alone, cut, and marked truncated.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries the full load and does most of it: paging contract (start/end exclusive, next_start, max_chars budget, truncated oversized turns), caveats that files_touched appears only on the first part with a 200-path cap, sub-agent listing limits, parent_session_id, and the staleness warning that these are dated records rather than live PR/issue state. What it never says explicitly is the safety profile (that this is a non-mutating read with no auth/permission requirements), so a 4 rather than a 5.

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

Conciseness3/5

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

Information-dense but structurally heavy: one enormous run-on sentence packs the turn-window, paging, files_touched caps, sub_agents and parent_session_id together, and the aside "Whole-session paging below is the fallback" refers to text that arrives later. Nearly every clause is load-bearing, but sectioning or bullets would make the branching logic far easier to scan.

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

Completeness5/5

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

For a five-parameter paginated reader with no output schema and no annotations, the description still tells the agent what comes back (session metadata, summary, turns, files_touched, sub_agents, returned/next_start), how to continue, and when the data is stale. There is no output schema to lean on, and the return shape is nonetheless fully described.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3; the description earns extra credit by explaining interactions the schema only hints at, such as turn winning over start, the ±window focus object returned ({turn, window, first_idx, last_idx, total_turns}), and that max_chars defaults to 12000 in turn-mode versus 60000 otherwise. Much of the per-parameter default/clamp text duplicates the schema, which keeps it from a 5.

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 and resource ("Retrieve a specific coding session by ID") and immediately enumerates the payload: user-spine turns, files touched, per-session summary. It also explicitly contrasts itself with the sibling session_summary ("short threaded overview of the same session") and ties its ID to memory_search records and list_recent_conversations rows, so an agent can place it among siblings without reading any schema.

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

Usage Guidelines5/5

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

Gives concrete entry paths (a memory_search record's session_id + turn_idx, a list_recent_conversations code row's id) and states the selection rule against the alternative: "Use it to read what was actually said; use session_summary for a short threaded overview." It also documents the drill-down loop (repeat with start=next_start until next_start is null) and the sub-agent traversal, leaving little to inference.

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