Skip to main content
Glama

Cancel transaction

cancel_transaction

Cancel a Midtrans transaction by order_id when it is still cancellable, such as a pending payment. This changes real merchant account state, so use it deliberately.

Instructions

Cancel a Midtrans transaction by order_id. Only works for transactions that can still be cancelled (e.g. pending payments). This changes real state in the merchant account — use deliberately.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "order_id": "<order_id>"
    },
    "name": "cancel_transaction"
  }
}

Input Schema

NameRequiredDescriptionDefault
order_idYesThe order_id to cancel.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the full burden. It does disclose the most important trait — 'changes real state in the merchant account — use deliberately' — and the cancellability precondition, but says nothing about what is returned, whether the operation is idempotent, or what happens to a transaction already settled.

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?

Two short sentences with zero filler: the action and key come first, then the precondition, then the caution. Every sentence earns its place.

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 single-parameter mutation with no output schema, the definition covers the essentials: what it does, when it is valid, and that it mutates real state. Return value and failure response shape remain unstated, which is the main remaining gap.

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% and the single order_id parameter is fully documented with pattern and length constraints in the schema. The phrase 'by order_id' adds no meaning beyond what the schema already provides, so the baseline 3 applies.

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 verb and resource: 'Cancel a Midtrans transaction by order_id.' The distinction from refund_transaction is only implicit (cancel vs. refund), so the agent can infer the difference but the description never names the sibling or contrasts them explicitly.

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?

Gives a concrete precondition — 'Only works for transactions that can still be cancelled (e.g. pending payments)' — which tells the agent when this will fail. It stops short of pointing to refund_transaction or get_transaction_status as the alternative path when a transaction is no longer cancellable.

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