Skip to main content
Glama

Apply to invoice (order to cash)

o2c_apply_payment
Destructive

Apply some or all of a payment to an invoice. Bounded on both sides: never more than the payment has left, never more than the invoice still owes. Both refusals name the actual numbers, so the right next step is obvious.

Overpayment is real and stays as unapplied cash against the customer. Do not spread it across invoices the customer did not name. Effects: application recorded; invoice.status -> paid when fully settled.

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": {
      "payment_id": "<payment_id>",
      "invoice_id": "<invoice_id>"
    },
    "name": "o2c_apply_payment"
  }
}

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.
payment_idYesThe payment. An existing payment id.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior5/5

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

Annotations only declare destructiveHint=true and idempotentHint=false; the description goes well beyond by disclosing the bilateral bound (never more than payment remainder, never more than invoice balance), that refusals echo the actual numbers, that surplus stays as unapplied cash on the customer, and the resulting state change (invoice.status -> paid when fully settled). This is exactly the mutation-and-side-effect context the annotations cannot carry.

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?

Front-loaded with the core action, then the bound, then the overpayment policy, then effects — a logical order. Every sentence carries content; only the 'right next step is obvious' clause is slightly editorial.

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 3-parameter mutation with no output schema, the description covers preconditions, bounds, failure messaging, surplus handling, and post-state. It does not describe what a successful response returns (application id, residual balances) or whether repeated submission double-applies, which leaves a small gap for an idempotentHint=false tool.

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%, so the baseline is 3, and the description adds genuine meaning beyond it by explaining that amount is clamped on both sides and what happens to the excess. It clarifies the semantics of under-paying without restating units or types.

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: 'Apply some or all of a payment to an invoice.' An agent can immediately tell this is a payment-to-invoice settlement operation, distinct from recording a payment. It stops short of naming a sibling (e.g., o2c_apply_credit, solo_apply_payment) to disambiguate which apply-variant to choose.

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 real usage constraint — 'Do not spread it across invoices the customer did not name' — which prevents a plausible misuse, and the omission rule for amount defines the default path. It does not name an alternative tool or state prerequisites (e.g., payment must exist and be unapplied), so it falls short of explicit alternative routing.

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.