Skip to main content
Glama

brain_session_end

DestructiveIdempotent

Close an active session by supplying a summary and next focus; reports unattributed artifacts created during the session.

Instructions

End a session from an explicit user command, on judgement alone.

nothing_to_capture_reason is now OPTIONAL. The old rule — a non-empty ledger XOR a written reason — measured whether the client had DECLARED its work. Derived capture feeds that signal from the server, and a check is hollow the moment the thing it checks can influence its own signal; worse, it made a session whose ledger the server had filled impossible to close. Give a reason if you have one to give; a blank one is still refused, because saying nothing and saying " " are not the same act.

What end still requires is what the server cannot produce for you: a summary and a next focus. It REPORTS unattributed_in_window — artifacts of this project created during the session that belong to no ledger — as a measure, never a gate. It cannot refuse a close, and a session cannot improve it by doing nothing.

An agent tracer is the only session the server opens or closes on its own; no hook and no auto-close may invoke this lifecycle boundary.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
summaryYes
next_focusYesJugement et engagements pour la session suivante — ce qui n'est pas dérivable automatiquement (ex : ne pas publier ce brouillon et pourquoi, une échéance et sa raison, une décision opérateur à respecter). N'y recopie pas l'état mesurable (révision de schéma, HEAD git, arbre propre, résultat de suite de tests) : il est déjà recalculé à chaque briefing depuis la source réelle, et une copie manuelle se périme en silence.
session_idYes
expected_client_keyYesClient identity expected for the addressed session UUID. The pair must match before any session mutation. This is an isolation guard, not authentication.
expected_focus_revisionYes
nothing_to_capture_reasonNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionYesPersistent state of one explicitly controlled concurrent session.
replayedYes
focus_diffNo
focus_at_endYes
current_focusYes
focus_outcomeYesPersisted outcome of the one focus update attempted while ending.
focus_revision_at_endNo
current_focus_revisionYes
unattributed_in_windowYes
remaining_open_session_countYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.1

TDQS

A4.2/5.0
Behavior5/5

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

The description goes well beyond the annotations by explaining that nothing_to_capture_reason is optional, that blank reasons are still refused, that unattributed_in_window is reported as a measure rather than a gate, and that the server cannot provide the required summary or next_focus. It also clarifies the only server-initiated lifecycle case. No statement contradicts the annotations.

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?

The description is front-loaded with the purpose and organized into clear blocks: purpose, parameter behavior, required inputs, and lifecycle boundary. The historical rationale about the old XOR check is somewhat longer than strictly necessary, but it supports the blank-reason rule. It is dense and structured, though trimming the design history would make it leaner.

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 destructive lifecycle operation with an output schema and annotations, the description covers the essential decision factors: when it may be invoked, what must be supplied, and what is reported rather than enforced. The remaining gaps are the lack of an explicit distinction from brain_session_abandon and the undocumented expected_focus_revision parameter. Still, an agent has enough context to call the tool correctly in most cases.

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 only 33% schema coverage, the description compensates meaningfully by explaining the optionality and refusal semantics of nothing_to_capture_reason and by emphasizing that summary and next_focus are required because the server cannot derive them. It does not explain expected_focus_revision or add much beyond what the schema already provides for the other parameters.

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?

The description opens with a specific verb and resource: 'End a session from an explicit user command, on judgement alone.' This makes the core operation clear. However, it does not explicitly contrast itself with the sibling tool brain_session_abandon, so the agent must infer how ending differs from abandoning a session.

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 description gives clear invocation context: only an explicit user command, never a hook or auto-close, may invoke this lifecycle boundary. It also states that callers must supply a summary and next_focus. It does not name alternatives or exclusion conditions relative to sibling session tools, which prevents a 5.

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