Skip to main content
Glama

Read session history

opencode_session_history
Read-only

Reads a session's messages and totals to inspect agent activity, audit tool calls, or export transcripts in JSON, markdown, or transcript format.

Instructions

Read a session's messages and totals. Useful for inspecting what an agent did, auditing tool calls, or exporting a transcript to another client.

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": "opencode_session_history"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoDefault 100
orderNo
cursorNo
formatNoDefault json
sessionIDYes
includeReasoningNoInclude reasoning blocks (default false)
includeToolCallsNoInclude tool calls in rendered output (default true)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, so safety is covered without the description. The description adds that it returns totals and supports transcript export, but says nothing about pagination via cursor/limit, ordering, or output size limits for a potentially large message history. With annotations carrying the safety profile, a 3 reflects some added value but gaps in operational behavior.

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

Conciseness5/5

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

Two short sentences, front-loaded with what the tool returns, followed by when it is useful. Every clause carries information and there is no filler or repetition of the title.

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?

With no output schema, the description should say more about what 'totals' and 'messages' actually look like, and it never explains the cursor-based pagination that two of the seven parameters imply. For a read tool over potentially long histories, that leaves an agent without guidance on iterating results.

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 coverage is 57%, with limit, format, includeReasoning and includeToolCalls self-documented while order, cursor and sessionID carry no schema description. The description adds essentially no parameter meaning beyond the weak hint that 'exporting a transcript' maps to format=transcript, so it neither compensates for the gap nor beats the schema baseline.

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?

"Read a session's messages and totals" states a specific verb and resource, which clearly separates it from mutating siblings like opencode_session_delete or opencode_session_compact. It does not, however, differentiate itself from the close sibling opencode_session_get, leaving the agent to guess which read variant to pick.

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?

The second sentence gives concrete use contexts — inspecting agent behavior, auditing tool calls, exporting a transcript — which is more than most definitions offer. It stops short of stating when not to use it or naming the alternative read tool, so the agent gets context but no explicit routing rule.

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