Skip to main content
Glama

Apply credit to invoice

o2c_apply_credit
Destructive

Apply some or all of a credit note to an invoice. Same bounds as cash: never more than the credit note has left, never more than the invoice still owes, never across customers. A credit note the customer wants paid out instead is a refund, not an application. Effects: application recorded; invoice.status -> paid when fully settled; credit_note.status -> settled when exhausted.

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": {
      "credit_note_id": "<credit_note_id>",
      "invoice_id": "<invoice_id>"
    },
    "name": "o2c_apply_credit"
  }
}

Input Schema

NameRequiredDescriptionDefault
amountNoHow much to apply. Omit to apply the smaller of what is left on each side. In cents (integer minor units) — 1250 means $12.50.
invoice_idYesThe invoice it settles. An existing invoice id.
credit_note_idYesThe credit note. An existing credit_note id.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations only declare that this is a destructive, non-read-only, non-idempotent write; the description goes well beyond them by disclosing the resulting state transitions (application recorded, invoice.status -> paid when fully settled, credit_note.status -> settled when exhausted) and the domain invariants enforced. It does not cover what happens when bounds are violated (error vs. clamping) or whether a repeated call creates a duplicate application, which matters given idempotentHint=false.

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 tight sentences: purpose first, then bounds and the refund exclusion, then effects. Nothing is repeated from the title or schema, and no sentence is filler.

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 three-parameter mutation tool with no output schema, the definition covers purpose, constraints, exclusion, and post-state effects, which is close to sufficient. The remaining gap is response shape — it never says whether the created application (or the updated invoice/credit note) is returned, which an agent needs to chain calls.

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 100% and the schema already explains that amount is in cents and that omission applies the smaller of the two remainders, so the baseline is 3. The description adds constraint semantics not present in the schema — amount can never exceed the credit note remainder or the invoice balance, and never crosses customers — which is genuine parameter-level meaning beyond the schema text.

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?

The description gives a specific verb and resource ('Apply some or all of a credit note to an invoice') and explicitly separates this operation from a refund ('A credit note the customer wants paid out instead is a refund, not an application'), which maps onto the o2c_refund sibling. It also distinguishes the operation from cash movement via 'Same bounds as cash', so an agent can place the tool without opening a schema.

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 states a clear when-not ('a credit note the customer wants paid out instead is a refund') and gives the eligibility bounds for using it (never exceeds credit note remainder, invoice balance, or crosses customers). It stops short of naming o2c_apply_payment or o2c_record_payment as the alternative for cash settlement, leaving that inference to the phrase 'Same bounds as cash'.

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.