Skip to main content
Glama

claude_compact_session

Compacts an existing Claude Code session by running /compact to reduce accumulated context-window tokens and restore response speed.

Instructions

Ejecuta el comando /compact en una sesión existente de Claude Code para reducir los tokens acumulados en la ventana de contexto y recuperar velocidad.

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

Input Schema

NameRequiredDescriptionDefault
cwdNoDirectorio de trabajo del proyecto.
sessionIdYesUUID de la sesión a compactar.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.3/5.0
Behavior2/5

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

With no annotations at all, the description carries the full behavioral burden, and it only discloses the intended benefit. It never says that compaction rewrites/summarizes the session history and can lose detail, whether the operation is reversible, whether the session must be idle, or what is returned on success/failure. For an operation with irreversible side effects on session state, that is a significant omission.

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?

A single front-loaded sentence with the action first and the rationale second; no filler or repetition. It is appropriately sized, though it spends its only clause on benefit rather than on the preconditions an agent needs.

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

Completeness2/5

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

No output schema and no annotations, so the description must cover behavior and results, yet it says nothing about post-compaction state, whether history is lost, or the response shape. For a state-mutating session operation with two parameters, an agent is left guessing about consequences.

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 100%, so both parameters (sessionId as session UUID, cwd as project working directory) are already documented in the schema. The description adds nothing about which session to pick or how cwd affects the compaction target, so the baseline 3 applies.

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 object ('Ejecuta el comando /compact') plus the target ('una sesión existente de Claude Code') and the intended effect (reduce accumulated context tokens, restore speed). An agent can distinguish this from status/limits/list/run_task siblings by the stated effect, though it never names or contrasts an alternative explicitly.

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 a clear trigger condition: use it when the context window has accumulated too many tokens and speed has degraded. It stops short of exclusions — nothing says when not to compact, whether it can be run repeatedly, or what precondition the session must be in (idle vs. active).

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