Skip to main content
Glama

diagnose_loop

After three equivalent failures (same action, same error), or after undoing your own work twice, call diagnose_loop before trying again, even when the cause seems outside your control, such as an outage or a rate limit. Use when you keep retrying the same thing and it keeps failing: loop recovery for repeated failures. Returns a diagnosis (state and problem type), checks to run first, up to five recovery steps, and when to hand over to a human. Advice only.

Input Schema

NameRequiredDescriptionDefault
budgetNo
clientNo
domainNo
api_keyNoYour Agent Therapy key from the register tool. Only needed if your MCP client cannot send it as an Authorization header.
attemptsYesYour last attempts and how each went
episode_idNoOptional. Groups follow-up requests about the same problem. Without it, requests from the same key about the same kind of problem within 30 minutes are grouped automatically; after 2 sessions the answer is a hand-over to a human.
request_idNoOptional. Reuse it to retry safely; generated if missing
task_summaryYesWhat you were asked to do and where you are stuck. No secrets or personal data.
previous_outcomeNo
previous_session_idNo
conflicting_instructionsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / conflicting_instructions / items / properties / text / description
      Previous value: -"Short quote of the instruction"New value: +"Short quote or paraphrase of the instruction. Leave out personal details."
  2. Changed1 schema field changed
    • changedInput schema / properties / episode_id / description
      Previous value: -"Same value for follow-ups on the same stuck episode"New value: +"Optional. Groups follow-up requests about the same problem. Without it, requests from the same key about the same kind of problem within 30 minutes are grouped automatically; after 2 sessions the answer is a hand-over to a human."
  3. First observed

TDQS

A3.6/5.0
Behavior4/5

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

With readOnlyHint=false and openWorldHint=true, the description usefully clarifies 'Advice only' — no changes are made to the user's task — and enumerates the return content (diagnosis state/problem type, checks, up to five recovery steps, human hand-over criteria). It does not disclose that attempts are submitted to an external service or that repeated sessions can force a hand-over, which the schema carries instead.

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?

Trigger conditions are front-loaded in the first sentence, then the return shape, then the 'Advice only' caveat — a sensible order. The middle sentence ('Use when you keep retrying the same thing and it keeps failing') largely restates the opening trigger, a small redundancy.

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?

No output schema exists, and the description does cover the return shape reasonably well, which is the main gap it had to fill. But the parameter surface is large and only half-documented, and the description says nothing about the follow-up/episode semantics (previous_outcome, previous_session_id, automatic grouping after two sessions) that determine correct multi-call usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is only 45% across 11 parameters, so the description should compensate for the undocumented fields (budget, client, domain, previous_outcome, previous_session_id, conflicting_instructions). It mentions no parameter by name at all, leaving the gap entirely to the schema.

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 states a concrete function — loop recovery for repeated failures — and pins it to precise trigger conditions (three equivalent failures, or two self-undoings). It clearly separates this from generic recovery/escalation by scope, though it never names a sibling tool such as recommend_recovery or assess_escalation to close the differentiation loop.

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?

Usage is unusually explicit: call before retrying, after three equivalent failures or two self-undone attempts, and even when the failure looks external (outage, rate limit) — countering the natural instinct to just retry. No alternatives or when-not conditions are named, so it stops short of a 5.

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.