Skip to main content
Glama

Session Doctor

session_doctor
Idempotent

Audit durable sessions for open, stale, or blocked cases, legacy metadata, evidence asks, provider errors, and token noise. Optionally repair specific convergence/health contradictions.

Instructions

Operational audit across durable sessions: open/stale/blocked cases, legacy self-lead metadata, open evidence asks (with per-peer item type drill-down + chronic blockers since v2.22), Grok provider errors, and token-event noise. Read-only by default (does not modify sessions). Terminal max-rounds and terminal not_resurfaced history stay in totals but are not default operational findings; pass include_terminal_findings=true to enumerate that historical inventory. Pass include_legacy=true to enumerate per-session self_lead_metadata entries (hidden by default since v2.22 because pre-v2.16 sessions carry the legacy artifact at ~38% rate; totals.self_lead_metadata count is always visible). v3.6.0: pass repair=true (opt-in) to recompute convergence_health for sessions stuck in the contradictory outcome="converged"+health="blocked" state left by pre-v3.2.0 corruption — only that specific contradiction is touched, only when explicitly requested; the repaired array lists what was fixed. The read-only pass needs no token; repair requires your own verified capability token and touches only the sessions you own.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
callerYes
repairNo
include_legacyNo
response_formatNojson
include_terminal_findingsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv4.4.18
    • removedInput schema / properties / caller / default
      Removed value: -"operator"
    • changedInput schema / properties / caller / enum
      Previous value: -[
      -  "codex",
      -  "claude",
      -  "gemini",
      -  "deepseek",
      -  "grok",
      -  "perplexity",
      -  "operator"
      -]New value: +[
      +  "codex",
      +  "claude",
      +  "gemini",
      +  "deepseek",
      +  "grok",
      +  "perplexity"
      +]
    • addedInput schema / required
      Added value: +[
      +  "caller"
      +]
  2. First observedv4.4.8

TDQS

A4.5/5.0
Behavior5/5

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

It discloses default read-only behavior, the opt-in write path, a token requirement for repair, scope to the caller's own sessions, and a precise constraint on what repair changes. This adds substantial context beyond the annotations, which only signal idempotent/non-destructive and not-readonly.

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 text is a single dense paragraph and somewhat long, but every clause adds operational detail and the main purpose is front-loaded. It could benefit from bullets, but nothing is filler.

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 complex tool with no output schema, it covers the key behaviors, scope, security, version caveats, and flag-driven variants, and even names response elements like totals.self_lead_metadata and the repaired array. It does not sketch the full response shape, but the essentials for correct invocation are present.

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 0% schema description coverage, the description carries the burden and does explain the meaningful flags: include_terminal_findings, include_legacy, and repair. It does not explain limit, caller, or response_format, though their schema types/enum values are largely self-explanatory.

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 opens with a specific verb ('audit') and a precise resource ('durable sessions'), then enumerates the distinct categories it covers (open/stale/blocked cases, legacy metadata, evidence asks, Grok errors, token-event noise). This semantically separates it from sibling list/read/metrics tools even without naming them.

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 gives clear context for when to invoke the tool and how to adjust scope via include_terminal_findings, include_legacy, and repair. It does not explicitly name sibling alternatives or state when not to use this tool, so it stops short of full exclusion guidance.

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