Skip to main content
Glama
Kiro MCP Server

Kiro MCP Server

Compact a Kiro session

kiro_session_compact

Compacts an idle Kiro session's context and returns the resulting context usage; fails with TURN_ACTIVE while a turn is running.

Instructions

Compact an idle session's context with _kiro/session/compact, like /compact, and return the context usage reported afterwards. Fails with TURN_ACTIVE while a turn runs.

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": {
      "session_id": "<session_id>"
    },
    "name": "kiro_session_compact"
  }
}

Input Schema

NameRequiredDescriptionDefault
session_idYesKiro session id (sess_<uuid>).

Output Schema

NameRequiredDescriptionDefault
kiroYes
session_idYes
context_usageYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A4/5.0
Behavior3/5

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

The annotations already declare readOnlyHint=false, destructiveHint=false, idempotentHint=false and openWorldHint=true. The description contributes the TURN_ACTIVE error contract and the fact that post-compaction context usage is returned, which is genuinely useful, but it never says what compaction actually discards or rewrites in the conversation - the main risk an agent needs to weigh before mutating a session's context.

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, action and precondition first, failure mode second, with zero filler or restatement of the title.

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?

With one required parameter, full schema coverage and an output schema that covers the returned context usage, the definition is nearly complete; the only meaningful omission for a context-rewriting operation is whether the compaction is reversible or what it drops.

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?

There is a single parameter with 100% schema description coverage ('Kiro session id (sess_<uuid>)' plus a UUID pattern), so the schema already carries full meaning. The description only adds that the session must be idle, which is behavioral rather than parameter-level detail; baseline 3 applies when schema coverage is complete.

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?

The description uses a specific verb ('Compact') on a specific resource ('an idle session's context'), names the underlying command (_kiro/session/compact) and a familiar analogue (/compact), so an agent can tell this apart from the surrounding session_export/fork/history tools at a glance.

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?

It states the precondition clearly ('idle session') and the failure condition ('Fails with TURN_ACTIVE while a turn runs'), which effectively tells the agent when not to call it. It stops short of naming an alternative path, such as cancelling the turn first or using kiro_session_fork/kiro_session_export when context must be preserved, so the routing guidance is implicit rather than explicit.

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