Skip to main content
Glama
MartinLoop — Stop Runaway Loops, Bad Code & Token Waste

MartinLoop — Stop Runaway Loops, Bad Code & Token Waste

martin_doctor

Read-onlyIdempotent

Run read-only diagnostics on the environment, engine, workspace, and run store to validate setup and spot suspicious state before software work or retries.

Instructions

Read-only environment, engine, workspace, and run-store diagnostics for MartinLoop. Use first for software work, fresh installs, suspicious state, or before retries. Do not use as proof that a task is complete. Next: call martin_estimate or martin_triage_runs depending on whether this is new work or failed prior work.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "martin_doctor"
  }
}

Input Schema

NameRequiredDescriptionDefault
engineNoOptional engine to highlight in diagnostics.
runsDirNoOptional runs-root override resolved under the default Martin runs root.
workingDirectoryNoOptional repo-root override for doctor context.

Output Schema

NameRequiredDescriptionDefault
serverYes
statusYes
enginesYes
summaryYes
runStoreYes
warningsYes
environmentYes
receiptScopeYes
requestedEngineNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.10.0
    • addedOutput schema / properties / runStore / properties / unreadableRecordCount
      Added value: +{
      +  "type": "integer"
      +}
    • addedOutput schema / properties / runStore / properties / warningsTruncated
      Added value: +{
      +  "type": "boolean"
      +}
    • changedOutput schema / properties / runStore / required
      Previous value: -[
      -  "exists",
      -  "loopCount"
      -]New value: +[
      +  "exists",
      +  "loopCount",
      +  "unreadableRecordCount",
      +  "warningsTruncated"
      +]
  2. Changed1 schema field changedv0.6.5
    • addedOutput schema / properties / runStore / properties / latestRun / properties / activeAttemptId
      Added value: +{
      +  "description": "ID of the currently active attempt, when a run is in progress.",
      +  "type": "string"
      +}
  3. Changed1 schema field changedv0.5.6
    • changedOutput schema / properties / runStore / properties / latestRun / required
      Previous value: -[
      -  "loopId",
      -  "title",
      -  "objective",
      -  "status",
      -  "lifecycleState",
      -  "attempts",
      -  "costUsd",
      -  "avoidedUsd",
      -  "pressure",
      -  "shouldStop",
      -  "remainingBudgetUsd",
      -  "remainingIterations",
      -  "remainingTokens"
      -]New value: +[
      +  "loopId",
      +  "title",
      +  "objective",
      +  "status",
      +  "lifecycleState",
      +  "attempts",
      +  "costUsd",
      +  "avoidedUsd",
      +  "pressure",
      +  "shouldStop",
      +  "remainingBudgetUsd",
      +  "remainingIterations"
      +]
  4. Changed2 schema fields changedv0.5.5
    • removedOutput schema / properties / runStore / properties / latestRun / properties / costProvenance
      Removed value: -{
      -  "enum": [
      -    "actual",
      -    "calculated",
      -    "estimated",
      -    "unavailable"
      -  ],
      -  "type": "string"
      -}
    • changedOutput schema / properties / runStore / properties / latestRun / required
      Previous value: -[
      -  "loopId",
      -  "title",
      -  "objective",
      -  "status",
      -  "lifecycleState",
      -  "attempts",
      -  "costUsd",
      -  "costProvenance",
      -  "avoidedUsd",
      -  "pressure",
      -  "shouldStop",
      -  "remainingBudgetUsd",
      -  "remainingIterations",
      -  "remainingTokens"
      -]New value: +[
      +  "loopId",
      +  "title",
      +  "objective",
      +  "status",
      +  "lifecycleState",
      +  "attempts",
      +  "costUsd",
      +  "avoidedUsd",
      +  "pressure",
      +  "shouldStop",
      +  "remainingBudgetUsd",
      +  "remainingIterations",
      +  "remainingTokens"
      +]
  5. Changed2 schema fields changedv0.5.3
    • addedOutput schema / properties / runStore / properties / latestRun / properties / costProvenance
      Added value: +{
      +  "enum": [
      +    "actual",
      +    "calculated",
      +    "estimated",
      +    "unavailable"
      +  ],
      +  "type": "string"
      +}
    • changedOutput schema / properties / runStore / properties / latestRun / required
      Previous value: -[
      -  "loopId",
      -  "title",
      -  "objective",
      -  "status",
      -  "lifecycleState",
      -  "attempts",
      -  "costUsd",
      -  "avoidedUsd",
      -  "pressure",
      -  "shouldStop",
      -  "remainingBudgetUsd",
      -  "remainingIterations",
      -  "remainingTokens"
      -]New value: +[
      +  "loopId",
      +  "title",
      +  "objective",
      +  "status",
      +  "lifecycleState",
      +  "attempts",
      +  "costUsd",
      +  "costProvenance",
      +  "avoidedUsd",
      +  "pressure",
      +  "shouldStop",
      +  "remainingBudgetUsd",
      +  "remainingIterations",
      +  "remainingTokens"
      +]
  6. First observedv0.3.9

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint and idempotentHint, and the description reinforces read-only while adding non-obvious behavioral context: the output is diagnostic evidence, not proof of task completion, and it should precede retries. It does not describe failure behavior (e.g., what happens if the environment is broken), so it stops short of a 5.

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

Conciseness5/5

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

Three short sentences, front-loaded with the purpose, then usage triggers, then the next-step routing. Every sentence carries distinct information with no repetition of the schema or annotations.

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?

With an output schema present, annotations covering safety, and fully documented parameters, the description only needs to supply purpose and sequencing, which it does. The minor gap is that it never says what a failing diagnostic looks like or how to act on one, which matters for a 'run this first' tool.

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% with three optional, self-documented parameters (engine enum, runsDir, workingDirectory), so the schema carries the semantics. The description adds no parameter-level meaning such as how overrides interact with defaults, which is the baseline 3 case.

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 resource set (environment, engine, workspace, run-store) and the operation (read-only diagnostics) for MartinLoop, which is far more than a restatement of the name. It does not explicitly differentiate itself from plausible siblings like martin_preflight or martin_inspect, so it falls short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit when-to-use triggers (first for software work, fresh installs, suspicious state, before retries), an explicit when-not ('Do not use as proof that a task is complete'), and routes to named alternatives (martin_estimate for new work, martin_triage_runs for failed prior work). This is the full when/when-not/alternatives pattern.

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