Skip to main content
Glama

Compact OpenCode session

opencode_session_compact

Summarize older session turns to free context and return the compaction inbox item plus before-and-after token totals when reported.

Instructions

Summarize older turns to free context. Returns the compaction inbox item and token totals before/after when the service reports them.

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_compact"
  }
}

Input Schema

NameRequiredDescriptionDefault
waitNoWait for the compaction to finish (default true)
sessionIDYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.4/5.0
Behavior3/5

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

Annotations give only readOnlyHint=false, so the description carries most of the load; it usefully discloses the return payload (compaction inbox item plus before/after token totals). However, for a mutation it omits important traits: whether the original older turns are discarded or just hidden, irreversibility, and any permission requirements. It also does not explain what changes when wait=false.

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?

Two tight, front-loaded sentences with the action first and the return contract second; nothing is redundant. The qualifier "when the service reports them" hedges output shape but is honest and short.

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 does a fair job covering the return shape, and the single required parameter is obvious. It remains incomplete on the lossy/irreversible nature of compaction and on the async (wait=false) path, which an agent needs before invoking.

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 50%: the wait parameter is documented in the schema, but sessionID has no description, and the tool description does not compensate by saying what sessionID identifies or what wait=false returns. Baseline 3 applies given partial schema coverage.

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?

States a specific verb and effect ("Summarize older turns to free context"), which tells an agent exactly what the tool does to the session. It does not explicitly name a sibling alternative (e.g. opencode_session_history or opencode_session_get) as the non-compacting option, so differentiation is inferred from the name 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?

The phrase "to free context" implies the triggering condition (context pressure), but there is no explicit when-to-use, when-not, or comparison against the history/get siblings. Usage is inferable rather than guided.

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