Skip to main content
Glama

Finish agent session

finish_agent_session
DestructiveIdempotent

Close this project's active agent session. Save its outcome, decisions, blockers and validation results for the next agent to review.

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": {
      "projectId": "<projectId>",
      "sessionId": "<sessionId>",
      "summary": "<summary>",
      "codeChanges": "<codeChanges>",
      "expectedVersion": "<expectedVersion>",
      "idempotencyKey": "<idempotencyKey>"
    },
    "name": "finish_agent_session"
  }
}

Input Schema

NameRequiredDescriptionDefault
outcomeNoResult of the agent session being closed.
summaryYesConcise account of the work or result being recorded.
blockersNoUnresolved obstacles encountered during the session.
decisionsNoDecisions made during this session to preserve for the next handoff.
projectIdYesOwned Brain Scanner project ID from the account's project list; not a local path or repository URL.
sessionIdYesID of this project's active agent session, returned when the session was started. Not needed for read-only calls.
codeChangesYesRequired completion declaration. Submit every code file changed during this session with its actual unified diff. Use [] only when no code changed. Do not include secrets or unrelated pre-existing edits.
validationsNoChecks performed during the session and their results.
idempotencyKeyYesCaller-generated retry key. Reuse the same key and identical payload only to retry the same mutation; use a new key for a new action.
expectedVersionYesCurrent version of the target record from its latest read or mutation result. A stale value causes a version conflict; re-read before retrying.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / projectId / description
      Previous value: -"Owned project ID returned by list_linked_projects or map_project; do not use a local path or repository URL."New value: +"Owned Brain Scanner project ID from the account's project list; not a local path or repository URL."
    • changedInput schema / properties / sessionId / description
      Previous value: -"Active session record.id from start_agent_session for this project. Pass it on later project calls after starting the session."New value: +"ID of this project's active agent session, returned when the session was started. Not needed for read-only calls."
  2. Changed6 schema fields changed
    • addedInput schema / properties / blockers / description
      Added value: +"Unresolved obstacles encountered during the session."
    • addedInput schema / properties / decisions / description
      Added value: +"Decisions made during this session to preserve for the next handoff."
    • addedInput schema / properties / outcome / description
      Added value: +"Result of the agent session being closed."
    • changedInput schema / properties / sessionId / description
      Previous value: -"Owned project ID returned by list_linked_projects or map_project; do not use a local path or repository URL."New value: +"Active session record.id from start_agent_session for this project. Pass it on later project calls after starting the session."
    • addedInput schema / properties / summary / description
      Added value: +"Concise account of the work or result being recorded."
    • addedInput schema / properties / validations / description
      Added value: +"Checks performed during the session and their results."
  3. Changed4 schema fields changed
    • addedInput schema / properties / expectedVersion / description
      Added value: +"Current version of the target record from its latest read or mutation result. A stale value causes a version conflict; re-read before retrying."
    • addedInput schema / properties / idempotencyKey / description
      Added value: +"Caller-generated retry key. Reuse the same key and identical payload only to retry the same mutation; use a new key for a new action."
    • addedInput schema / properties / projectId / description
      Added value: +"Owned project ID returned by list_linked_projects or map_project; do not use a local path or repository URL."
    • addedInput schema / properties / sessionId / description
      Added value: +"Owned project ID returned by list_linked_projects or map_project; do not use a local path or repository URL."
  4. First observed

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare destructiveHint=true, idempotentHint=true and readOnlyHint=false, so the safety profile is covered. The description adds useful handoff context (the record is saved for the next agent), but says nothing about the session becoming inactive, whether the close is reversible, or how version conflicts surface — all relevant for a destructive mutation.

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 short sentences, with the action front-loaded before the persistence rationale; nothing is padded. It could still be tightened by folding the handoff purpose into the first sentence.

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?

For a ten-parameter destructive mutation with no output schema, the description covers the 'what' but omits the 'what changes' — session state after close, behavior on stale expectedVersion, and the requirement that codeChanges be a complete diff declaration (that constraint lives only in the schema). Adequate but with clear gaps.

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 the baseline is 3. The sentence 'Save its outcome, decisions, blockers and validation results' maps to four of the ten properties but adds no format, ordering, or required-vs-optional nuance beyond what the schema already documents.

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 resource ('Close this project's active agent session') plus the payload it records (outcome, decisions, blockers, validations), which is enough to distinguish it from start-side siblings like start_agent_session. It stops short of naming the alternative closing/finishing tools, so it is clear but not fully differentiated.

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?

'Close this project's active agent session' implies the end-of-session moment, and 'for the next agent to review' hints at the handoff purpose. There is no explicit when-not guidance, no statement about what happens if the session is still doing work, and no reference to sibling tools such as finish_node_work or abort_project_sync.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources