Skip to main content
Glama

get_thread_context

Read-onlyIdempotent

Packs thread messages, edits, references, FSM history, and workspace glossary into agent prompts with as-of replay, token caps, and delta updates.

Instructions

Pack thread messages, edits, references, FSM history, and the workspace glossary for agent prompts. Edits are lean by default (id/editor/timestamp only); pass include_edits=true for full before/after bodies. The glossary (canonical term definitions) is included by default when non-empty; pass include_glossary=false to drop it. Pass as_of=<event_id> to replay the thread as it stood at that event-log id (deterministic over the immutable log; audit / re-ask from before a tangent). Pass token_budget= to cap the message page by estimated tokens: the opening message and the recent tail are kept, the middle is folded into an auditable elision marker in fixed blocks. The result is two text parts: the stable prefix (workspace boot, brief, messages) and the volatile tail (state, lease, cursors, prefix sha256). Those strings are the bytes REST returns with split=true.

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": {
      "thread_id": "<thread_id>"
    },
    "name": "get_thread_context"
  }
}

Input Schema

NameRequiredDescriptionDefault
as_ofNoEvent-log id: reconstruct the thread as it stood at that point (as-of replay). Omit for the live pack.
deltaNoReturn a delta instead of the whole pack. The first content part is always the delta head (delta, prefix_unchanged, prefix_sha256, prefix_bytes), never empty; the second is the volatile tail. When since_prefix_sha matches the current prefix, the head has prefix_unchanged true and no messages or prefix. With message_cursor, the head adds the messages after that cursor when appending them rebuilds the prefix; otherwise it carries the replacement prefix.
max_bytesNoCap the canonical pack by bytes. Elision grows by fixed message blocks until the pack fits or only the opener and newest message remain.
thread_idYes
token_budgetNoCap the message page by estimated tokens (chars/4): keep the opening message and the recent tail, fold the middle into an auditable 'elision' marker. Omit to cap by rows only.
include_editsNoInclude full body_before/body_after on each edit (heavy); default returns edit metadata only.
message_limitNo
message_cursorNoPage messages after this id. With delta, it is also the delta cursor.
include_glossaryNoInclude the workspace glossary (grounding); omitted when empty. Set false for a token-tight pack.
since_prefix_shaNoHex sha256 of a prefix the caller already holds. Requests a delta on its own.
transition_limitNo
include_parent_groundingNoFor a child thread, attach parent grounding (the parent's opening ask + latest decision) so a fresh claimer knows why the thread exists. Absent for root threads / cross-channel / DM parents. Set false for the leanest pack.
include_accepted_decisionsNoAttach in-channel accepted/closed decisions (token-lean teasers) so a fresh claimer sees what the channel already decided. Waiter envelopes appear only when status is reviewed; result_kind is a namespaced string (e.g. example.review.result/1), not a closed enum. Withheld on DM channels. Set false for the leanest pack.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv479.0.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already cover the read-only/idempotent/non-destructive profile, and the description adds substantial behavior beyond them: lean edit defaults, glossary inclusion when non-empty, deterministic replay over an immutable log, and mid-page folding into an 'auditable elision marker in fixed blocks'. It also discloses the two-part return shape (stable prefix vs volatile tail) and that the strings equal REST bytes with split=true, though rate limits, failure modes, and permission requirements go unmentioned.

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?

Front-loaded with purpose, then a dense sequence of parameter-mode notes; nearly every sentence carries a distinct fact. There is mild redundancy where token_budget and include_edits behavior is restated in both the description and the schema, but the description is the richer of the two and stays readable.

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

Completeness4/5

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

For a 13-parameter tool with no output schema, the description compensates well by describing the returned two text parts and the prefix/tail split. The remaining shortfall is routing: an agent still lacks explicit criteria for picking this pack over the narrower thread-context siblings or for combining delta with cursor paging.

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?

With 77% schema coverage the baseline is 3, and the description earns more by explaining mechanics the schema only sketches: what as_of replays, exactly which content token_budget preserves (opener + recent tail) and what replaces the rest. It stays silent on max_bytes, delta/since_prefix_sha, message_cursor, and the two include_* defaults, but those have schema descriptions carrying their weight.

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

Purpose4/5

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

"Pack thread messages, edits, references, FSM history, and the workspace glossary for agent prompts" gives a specific verb (pack) and a precise resource list, and the 'for agent prompts' framing separates it from single-fact getters like get_thread_block or get_glossary_term. It never names a sibling outright, so the differentiation is inferred rather than stated.

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

Usage Guidelines3/5

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

Guidance is mode-level rather than tool-level: as_of is tied to audit/re-ask-from-before-a-tangent, include_edits=true to full bodies, include_glossary=false for token-tight packs. Nothing tells the agent when to choose this over snapshot_thread_context, get_workspace_context, or the individual get_* siblings, which is the main gap.

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

Deploy Server

Other Tools