Skip to main content
Glama
Keesan12

MartinLoop — Stop Runaway Loops, Bad Code & Token Waste

martin_doctor

Read-onlyIdempotent

Diagnose environment, engine, workspace, and run-store state with read-only checks. Use before new work, installs, or retries to catch issues that lead to runaway loops and wasted tokens.

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.

Input Schema

TableJSON 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

TableJSON Schema
NameRequiredDescriptionDefault
serverYes
statusYes
enginesYes
summaryYes
runStoreYes
warningsYes
environmentYes
receiptScopeYes
requestedEngineNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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"
      +}
  2. 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"
      +]
  3. 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"
      +]
  4. 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"
      +]
  5. First observedv0.3.9

TDQS

A4.3/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's 'Read-only' phrasing reinforces this without adding conflict. It adds behavioral value by scoping the diagnostic domains and by warning that the output is not proof of completion, which is a meaningful non-obvious trait. With annotations covering safety, this is strong but not maximal.

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 concise sentences deliver purpose, usage timing, exclusions, and next steps with no filler. The most important information is front-loaded, and every sentence earns its place. Reusing 'Read-only' from annotations is minor redundancy but not harmful to an agent scanning prose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with zero required parameters, a complete output schema, and read-only/idempotent annotations, the description covers all essential decision-making context. It includes scope, when to invoke, what not to infer, and which sibling to call next. An agent can safely invoke this tool correctly without further clarification.

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 all three optional parameters already thoroughly described in the input schema. The description itself adds no parameter-specific guidance, but the schema carries the full burden. This meets the baseline for a fully covered 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 clearly identifies the tool as read-only diagnostics for environment, engine, workspace, and run-store data, which is specific about resources and scope. It lacks an explicit active verb like 'get' or 'run', instead using the noun phrase 'diagnostics', though the intent is unmistakable. It distinguishes from siblings by positioning itself as a first-step diagnostic rather than a completion check.

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?

The description explicitly states when to use the tool: 'Use first for software work, fresh installs, suspicious state, or before retries.' It also provides a clear exclusion: 'Do not use as proof that a task is complete.' It routes the agent to the appropriate next tool based on whether the work is new or failed, making the decision tree explicit.

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