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

MartinLoop — Stop Runaway Loops, Bad Code & Token Waste

martin_cancel

DestructiveIdempotent

Publish a durable cancellation signal to stop an active run when work must halt. The active executor polls it to abort the provider, restore governed workspace state, and record terminal evidence.

Instructions

Publish the canonical durable cancellation signal for one active MartinLoop run. The active executor polls this signal, aborts its provider, restores governed workspace state, and records terminal evidence. Use the tool when work must stop; publication is not application proof, so use martin_status to observe terminal state or martin_pause for a reversible safe-boundary hold.

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_cancel"
  }
}

Input Schema

NameRequiredDescriptionDefault
fileNoPath to one canonical run record or directory. Mutually exclusive with loopId and latest.
latestNoWhen true, targets the latest canonical run. Mutually exclusive with file and loopId.
loopIdNoCanonical MartinLoop run identifier. Mutually exclusive with file and latest.
reasonNoOptional non-empty reason recorded in the cancellation receipt.
runsDirNoOptional run-store root override used to resolve loopId or latest.

Output Schema

NameRequiredDescriptionDefault
okYesWhether the control receipt was recorded.
stateYes
actionYesThe control action that was recorded.
loopIdYesMartinLoop run identifier the control was applied to.
reasonNoHuman-readable reason for the control, if provided.
summaryYesHuman-readable result of the control request.
controlIdYesUnique receipt ID for this control action.
principalYes
receiptHashYes
requestedAtYesISO 8601 timestamp when the control was recorded.
requestedActionYesThe control action that was requested.
applicationStateYesWhether the active executor has applied the control; publication alone is not application proof.
publicationStateYesWhether an authoritative cancellation signal was published or a cooperative receipt was recorded.
authorityBoundaryYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed12 schema fields changedv0.9.0
    • removedInput schema / properties / requestedBy
      Removed value: -{
      -  "description": "Optional human or runtime identity label recorded for audit context.",
      -  "type": "string"
      -}
    • addedOutput schema / properties / applicationState
      Added value: +{
      +  "description": "Whether the active executor has applied the control; publication alone is not application proof.",
      +  "enum": [
      +    "pending_observation",
      +    "requested_only",
      +    "terminal_reconciled"
      +  ],
      +  "type": "string"
      +}
    • addedOutput schema / properties / authorityBoundary
      Added value: +{
      +  "const": "local_os_user"
      +}
    • addedOutput schema / properties / principal
      Added value: +{
      +  "const": "local_mcp_client"
      +}
    • addedOutput schema / properties / publicationState
      Added value: +{
      +  "description": "Whether an authoritative cancellation signal was published or a cooperative receipt was recorded.",
      +  "enum": [
      +    "published",
      +    "already_requested",
      +    "receipt_recorded",
      +    "published_audit_pending"
      +  ],
      +  "type": "string"
      +}
    • addedOutput schema / properties / receiptHash
      Added value: +{
      +  "pattern": "^[a-f0-9]{64}$",
      +  "type": "string"
      +}
    • removedOutput schema / properties / requestedBy
      Removed value: -{
      -  "description": "Identity that requested the control, if provided.",
      -  "type": "string"
      -}
    • changedOutput schema / properties / state / additionalProperties
      Previous value: -trueNew value: +false
    • removedOutput schema / properties / state / description
      Removed value: -"Run control state after this request, including all recorded receipts."
    • addedOutput schema / properties / state / properties
      Added value: +{
      +  "applicationPath": {
      +    "type": "string"
      +  },
      +  "applications": {
      +    "items": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "action": {
      +          "enum": [
      +            "pause_applied",
      +            "continue_applied"
      +          ],
      +          "type": "string"
      +        },
      +        "applicationHash": {
      +          "pattern": "^[a-f0-9]{64}$",
      +          "type": "string"
      +        },
      +        "appliedAt": {
      +          "type": "string"
      +        },
      +        "controlId": {
      +          "type": "string"
      +        },
      +        "loopId": {
      +          "type": "string"
      +        },
      +        "previousApplicationHash": {
      +          "pattern": "^[a-f0-9]{64}$",
      +          "type": "string"
      +        },
      +        "receiptHash": {
      +          "pattern": "^[a-f0-9]{64}$",
      +          "type": "string"
      +        },
      +        "relatedControlId": {
      +          "type": "string"
      +        },
      +        "schemaVersion": {
      +          "const": "martin.run-control-application.v2"
      +        }
      +      },
      +      "required": [
      +        "schemaVersion",
      +        "loopId",
      +        "controlId",
      +        "action",
      +        "appliedAt",
      +        "receiptHash",
      +        "applicationHash"
      +      ],
      +      "type": "object"
      +    },
      +    "type": "array"
      +  },
      +  "appliedState": {
      +    "enum": [
      +      "active",
      +      "paused",
      +      "cancellation_pending",
      +      "terminal"
      +    ],
      +    "type": "string"
      +  },
      +  "approvalState": {
      +    "enum": [
      +      "not_required",
      +      "resume_requested"
      +    ],
      +    "type": "string"
      +  },
      +  "latestReceipt": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "action": {
      +        "enum": [
      +          "pause",
      +          "cancel",
      +          "continue"
      +        ],
      +        "type": "string"
      +      },
      +      "authorityBoundary": {
      +        "const": "local_os_user"
      +      },
      +      "controlId": {
      +        "type": "string"
      +      },
      +      "executorLeaseToken": {
      +        "type": "string"
      +      },
      +      "expectedPreviousControlId": {
      +        "type": "string"
      +      },
      +      "loopId": {
      +        "type": "string"
      +      },
      +      "previousReceiptHash": {
      +        "pattern": "^[a-f0-9]{64}$",
      +        "type": "string"
      +      },
      +      "principal": {
      +        "const": "local_mcp_client"
      +      },
      +      "projectId": {
      +        "type": "string"
      +      },
      +      "reason": {
      +        "type": "string"
      +      },
      +      "receiptHash": {
      +        "pattern": "^[a-f0-9]{64}$",
      +        "type": "string"
      +      },
      +      "requestedAt": {
      +        "type": "string"
      +      },
      +      "schemaVersion": {
      +        "const": "martin.run-control.v2"
      +      },
      +      "workspaceId": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "schemaVersion",
      +      "controlId",
      +      "loopId",
      +      "action",
      +      "requestedAt",
      +      "authorityBoundary",
      +      "principal",
      +      "executorLeaseToken",
      +      "receiptHash"
      +    ],
      +    "type": "object"
      +  },
      +  "publications": {
      +    "items": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "controlId": {
      +          "type": "string"
      +        },
      +        "loopId": {
      +          "type": "string"
      +        },
      +        "previousPublicationHash": {
      +          "pattern": "^[a-f0-9]{64}$",
      +          "type": "string"
      +        },
      +        "publicationHash": {
      +          "pattern": "^[a-f0-9]{64}$",
      +          "type": "string"
      +        },
      +        "receiptHash": {
      +          "pattern": "^[a-f0-9]{64}$",
      +          "type": "string"
      +        },
      +        "recordedAt": {
      +          "type": "string"
      +        },
      +        "schemaVersion": {
      +          "const": "martin.run-control-publication.v1"
      +        },
      +        "signalState": {
      +          "enum": [
      +            "created",
      +            "already_exists"
      +          ],
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "schemaVersion",
      +        "loopId",
      +        "controlId",
      +        "receiptHash",
      +        "signalState",
      +        "recordedAt",
      +        "publicationHash"
      +      ],
      +      "type": "object"
      +    },
      +    "type": "array"
      +  },
      +  "receiptPath": {
      +    "type": "string"
      +  },
      +  "receipts": {
      +    "items": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "action": {
      +          "enum": [
      +            "pause",
      +            "cancel",
      +            "continue"
      +          ],
      +          "type": "string"
      +        },
      +        "authorityBoundary": {
      +          "const": "local_os_user"
      +        },
      +        "controlId": {
      +          "type": "string"
      +        },
      +        "executorLeaseToken": {
      +          "type": "string"
      +        },
      +        "expectedPreviousControlId": {
      +          "type": "string"
      +        },
      +        "loopId": {
      +          "type": "string"
      +        },
      +        "previousReceiptHash": {
      +          "pattern": "^[a-f0-9]{64}$",
      +          "type": "string"
      +        },
      +        "principal": {
      +          "const": "local_mcp_client"
      +        },
      +        "projectId": {
      +          "type": "string"
      +        },
      +        "reason": {
      +          "type": "string"
      +        },
      +        "receiptHash": {
      +          "pattern": "^[a-f0-9]{64}$",
      +          "type": "string"
      +        },
      +        "requestedAt": {
      +          "type": "string"
      +        },
      +        "schemaVersion": {
      +          "const": "martin.run-control.v2"
      +        },
      +        "workspaceId": {
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "schemaVersion",
      +        "controlId",
      +        "loopId",
      +        "action",
      +        "requestedAt",
      +        "authorityBoundary",
      +        "principal",
      +        "executorLeaseToken",
      +        "receiptHash"
      +      ],
      +      "type": "object"
      +    },
      +    "type": "array"
      +  },
      +  "requestedState": {
      +    "enum": [
      +      "active",
      +      "paused",
      +      "cancellation_requested",
      +      "terminal"
      +    ],
      +    "type": "string"
      +  }
      +}
    • addedOutput schema / properties / state / required
      Added value: +[
      +  "requestedState",
      +  "approvalState",
      +  "appliedState",
      +  "receipts",
      +  "applications",
      +  "publications"
      +]
    • changedOutput schema / required
      Previous value: -[
      -  "loopId",
      -  "action",
      -  "controlId",
      -  "requestedAt",
      -  "ok",
      -  "summary",
      -  "requestedAction",
      -  "state"
      -]New value: +[
      +  "loopId",
      +  "action",
      +  "controlId",
      +  "requestedAt",
      +  "ok",
      +  "summary",
      +  "requestedAction",
      +  "publicationState",
      +  "applicationState",
      +  "authorityBoundary",
      +  "principal",
      +  "receiptHash",
      +  "state"
      +]
  2. Changed5 schema fields changedv0.8.6
    • addedOutput schema / properties / ok
      Added value: +{
      +  "description": "Whether the control receipt was recorded.",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / requestedAction
      Added value: +{
      +  "description": "The control action that was requested.",
      +  "enum": [
      +    "pause",
      +    "cancel",
      +    "continue"
      +  ],
      +  "type": "string"
      +}
    • addedOutput schema / properties / state
      Added value: +{
      +  "additionalProperties": true,
      +  "description": "Run control state after this request, including all recorded receipts.",
      +  "type": "object"
      +}
    • addedOutput schema / properties / summary
      Added value: +{
      +  "description": "Human-readable result of the control request.",
      +  "type": "string"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "loopId",
      -  "action",
      -  "controlId",
      -  "requestedAt"
      -]New value: +[
      +  "loopId",
      +  "action",
      +  "controlId",
      +  "requestedAt",
      +  "ok",
      +  "summary",
      +  "requestedAction",
      +  "state"
      +]
  3. Changed1 schema field changedv0.6.6
    • removedInput schema / oneOf
      Removed value: -[
      -  {
      -    "required": [
      -      "file"
      -    ]
      -  },
      -  {
      -    "required": [
      -      "loopId"
      -    ]
      -  },
      -  {
      -    "required": [
      -      "latest"
      -    ]
      -  }
      -]
  4. Changed6 schema fields changedv0.5.9
    • addedInput schema / properties / file / description
      Added value: +"Path to one canonical run record or directory. Mutually exclusive with loopId and latest."
    • addedInput schema / properties / latest / description
      Added value: +"When true, targets the latest canonical run. Mutually exclusive with file and loopId."
    • addedInput schema / properties / loopId / description
      Added value: +"Canonical MartinLoop run identifier. Mutually exclusive with file and latest."
    • addedInput schema / properties / reason / description
      Added value: +"Optional non-empty reason recorded in the cancellation receipt."
    • addedInput schema / properties / requestedBy / description
      Added value: +"Optional human or runtime identity label recorded for audit context."
    • addedInput schema / properties / runsDir / description
      Added value: +"Optional run-store root override used to resolve loopId or latest."
  5. Changed3 schema fields changedv0.5.6
    • changedOutput schema / additionalProperties
      Previous value: -trueNew value: +false
    • addedOutput schema / properties
      Added value: +{
      +  "action": {
      +    "description": "The control action that was recorded.",
      +    "enum": [
      +      "pause",
      +      "cancel",
      +      "continue"
      +    ],
      +    "type": "string"
      +  },
      +  "controlId": {
      +    "description": "Unique receipt ID for this control action.",
      +    "type": "string"
      +  },
      +  "loopId": {
      +    "description": "MartinLoop run identifier the control was applied to.",
      +    "type": "string"
      +  },
      +  "reason": {
      +    "description": "Human-readable reason for the control, if provided.",
      +    "type": "string"
      +  },
      +  "requestedAt": {
      +    "description": "ISO 8601 timestamp when the control was recorded.",
      +    "type": "string"
      +  },
      +  "requestedBy": {
      +    "description": "Identity that requested the control, if provided.",
      +    "type": "string"
      +  }
      +}
    • addedOutput schema / required
      Added value: +[
      +  "loopId",
      +  "action",
      +  "controlId",
      +  "requestedAt"
      +]
  6. 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 idempotentHint=true and destructiveHint=true, so the description's job is to add context — and it does, disclosing that cancellation is a signal rather than an applied state change ('publication is not application proof') and that it triggers workspace-state restoration and terminal-evidence recording. It stops short of stating what happens if the target run is not active or whether republishing supersedes a prior signal, which keeps it from 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.

Conciseness4/5

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

Three front-loaded sentences with no filler: purpose, lifecycle, then usage routing. Minor density cost from jargon like 'governed workspace state' and 'terminal evidence', which an agent must infer, but nothing is wasted.

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 destructive, idempotent, zero-required-parameter tool with a full schema and an output schema, this covers purpose, async semantics, and alternatives well. The remaining gap is edge-case behavior — cancelling an already-terminal or nonexistent run — which matters for a destructive operation but is not addressed.

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%, so the mutual-exclusivity of file/latest/loopId and the meaning of runsDir and reason are already fully documented. The description only adds the constraint that the target must be one active run; it contributes no parameter-level detail beyond the schema, so the baseline 3 applies.

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?

States a specific verb and resource: 'Publish the canonical durable cancellation signal for one active MartinLoop run.' It also describes the downstream effect (executor polls, aborts provider, restores workspace state), which distinguishes it from the pause/continue siblings without needing their schemas.

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?

Explicit when-to-use ('when work must stop') plus named alternatives with the condition that selects them: martin_status to observe terminal state, martin_pause for a reversible safe-boundary hold. The agent gets both the trigger and the routing rule in one sentence.

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