Skip to main content
Glama

ERP: Cancel a sale (stock back, invoice cancelled)

erp_sale_cancel
Destructive

Cancel a recorded SALE (a sales order, e.g. SO-8): the payments on its invoice are reversed and the invoice cancelled, the goods that left the warehouse are put back in stock (return_stock=false if the goods did not come back), and the order is cancelled. Use for «скасуй продаж», «повернення», «клієнт повернув товар», and to CORRECT a sale: cancel it, then record the right one with erp_record_sale (say so to the person: two cards). Find the number with erp_sales_report / erp_order_list. An invoice-only sale (no order) is cancelled with invoice_cancel. Proposed write: one card listing the stock going back and the invoice. CONFIRMATION: this tool is PROPOSED, never performed directly. You get status='confirmation_required' with an action_id and a plan_token, and the write happens only after confirm_action.

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": "<order>"
    },
    "name": "erp_sale_cancel"
  }
}

Input Schema

NameRequiredDescriptionDefault
orderYes
reasonNo
return_stockNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already flag destructive=true, but the description adds substantial behavior beyond them: the exact side effects on payments, invoice and stock, the return_stock=false escape hatch for goods that stayed with the customer, and the mandatory two-phase confirmation protocol with status='confirmation_required', action_id and plan_token. This tells the agent it will not write immediately and what to surface to the user.

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?

Dense but well front-loaded: the resource and effects come first, then usage triggers, then the lookup/alternative routing, then the confirmation protocol. A few clauses restate cancellation ('the order is cancelled') and the phrasing is compressed actively, but almost every sentence carries routing or behavioral value.

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?

There is no output schema, yet the description documents the important part of the response (status, action_id, plan_token) and the required follow-up confirm_action, plus the proposed card contents. For a destructive three-parameter write tool this leaves nothing an agent needs unknown before calling.

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 description coverage is 0%, so the description must carry parameter meaning: it explains return_stock's semantics ('false if the goods did not come back') and identifies 'order' as a sale number like SO-8 that can be found via erp_sales_report/erp_order_list. Only 'reason' is left undefined, a minor remaining gap given its self-evident nature.

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 ('Cancel a recorded SALE') and enumerates the concrete effects: payments reversed, invoice cancelled, stock returned, order cancelled. It is clearly distinguishable from invoice_cancel and erp_record_sale by naming those siblings and their scopes.

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 triggers (including user phrasings «скасуй продаж», «повернення»), the correction workflow (cancel then erp_record_sale), and two named alternatives: erp_sales_report/erp_order_list for finding the number, and invoice_cancel for invoice-only sales. When-not-to-use is effectively covered by the invoice-only exclusion.

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.

Resources