Skip to main content
Glama

Cancel a purchase or sale

cancel_purchase
DestructiveIdempotent

Cancels a purchase before the handover, when the person (the buyer, or the seller) asks to. The buyer's card was only held, so the hold is released and nothing is charged, and the other side is told. When the buyer cancels, the item goes back on sale; when the seller cancels, the listing comes down unless put_back_on_sale. Confirm with the person first, then pass confirmed: true. Not possible after the handover. Needs sign-in.

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": {
      "sale_id": "<sale_id>",
      "confirmed": "<confirmed>"
    },
    "name": "cancel_purchase"
  }
}

Input Schema

NameRequiredDescriptionDefault
asNoOnly when the person is both buyer and seller (a test): which side to act as.
reasonNoWhy, in the person's words, if they gave one. Shown to the other side.
sale_idYes
confirmedYesTrue only once the person has confirmed they want to cancel.
put_back_on_saleNoThe seller only: put the item back on sale instead of taking the listing down.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.5/5.0
Behavior5/5

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

Beyond the annotations (which already declare destructiveHint=true, idempotentHint=true, openWorldHint=true), the description discloses the concrete consequences: the pre-authorization hold is released and nothing is charged, the counterparty is notified, and the item either returns to sale or the listing comes down. That is exactly the side-effect detail an agent needs before invoking a destructive, open-world mutation.

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?

The core constraint (pre-handover cancellation) is front-loaded and each sentence covers a distinct fact: precondition, charge/hold behavior, per-side listing outcome, confirmation flow, and auth. The card-hold sentence is slightly convoluted with its chained clauses, but almost 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 five-parameter destructive mutation with no output schema, the definition covers preconditions, authorization, both actor branches, and downstream effects, which is close to complete. It does not say what the caller gets back or what happens to an in-flight payment/dispute, leaving a small gap.

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

Parameters4/5

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

Schema coverage is 80%, so the schema already explains as, reason, and put_back_on_sale; the description nonetheless adds operational meaning by tying confirmed to the required confirm-with-the-person sequence and by linking the seller-cancel path to the put_back_on_sale outcome. The only underexplained element is sale_id, which carries no description in the schema.

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?

"Cancels a purchase before the handover" names a specific verb and resource and bounds it with a state precondition (pre-handover) plus both actor perspectives (buyer or seller). The purchase/sale framing with card hold and listing side-effects makes it clearly distinguishable from a pickup-order cancellation without needing to name a sibling.

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?

It gives a real when-to-use trigger ("when the person asks to"), an explicit when-not ("Not possible after the handover"), a prerequisite ("Needs sign-in"), and a required workflow step (confirm with the person, then pass confirmed: true). It stops short of naming what to do instead once handover has occurred, so the agent is left to infer an alternative path.

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.