Skip to main content
Glama

session_delete

DestructiveIdempotent

Delete a gateway session by ID to remove its record and free associated resources. Confirmation is immediate; worktree cleanup runs asynchronously with safe retry handling.

Instructions

Delete a gateway session record by ID. The tool result confirms record deletion; worktree cleanup observers run asynchronously and may still be in progress. Worktree cleanup runs on the processing host for file-backed and PostgreSQL session managers. Both managers stage a caller-hidden cleanup tombstone before cleanup runs and retain a failed removal for retry by the host that owns the worktree, finalizing the record only once Git no longer registers the worktree, read back rather than inferred from the recorded path being absent. File-backed TTL eviction uses the same tombstone retry path. Deletion processed by a different host removes no worktree and leaves the owning host's record intact. The database-side cleanup_expired_sessions function stages the same tombstone instead of deleting a worktree-bearing session; it invokes no gateway observer and so attempts no removal itself. A tombstone is not bounded by retention.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv3.2.0
  2. Removedv3.0.0
  3. First observedv2.16.0

TDQS

A4.2/5.0
Behavior5/5

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

Annotations already mark it destructive and idempotent, but the description adds substantial behavioral nuance: cleanup is asynchronous, cross-host deletions do not remove worktrees or destroy the owning host's record, and tombstones/retries are used. This goes well beyond the structured hints and prevents false assumptions about immediate full cleanup.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The action is front-loaded in a clear first sentence, but the rest is a dense single paragraph of implementation detail about tombstones, retries, and Git worktree finalization. The detail is relevant, but it is longer and more convoluted than necessary for tool selection and invocation.

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 one-parameter destructive tool with no output schema, the description covers the key behavioral edge cases: async cleanup, cross-host semantics, and the database-side cleanup path. It does not describe the exact result payload or not-found behavior, but the confirmation statement and idempotentHint cover the main operational expectations.

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 100%, and the only parameter, sessionId, is already described as 'Session ID' in the schema. The description adds only the context that it identifies the gateway session record to delete, which is marginal additional meaning.

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 first sentence is explicit: 'Delete a gateway session record by ID,' naming the verb, resource, and primary selector. This clearly distinguishes it from sibling session tools like session_get, session_create, and session_clear_all.

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 makes clear this tool is for deleting a single gateway session by ID and sets expectations about async worktree cleanup and cross-host behavior. It does not explicitly list alternatives or state when not to use it, but the context is sufficiently clear for selection.

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