Skip to main content
Glama

deductCredits

Destructive

Deduct credits from a customer's credit balance, as an administrator charge. Returns the created credits transaction. Credits that expire soonest are deducted first. Fails when the customer has fewer credits than the amount: check the balance with getCreditsBalances first. Pass the customer's location as transaction.locationRef. Each call creates a new transaction: when a call fails or times out, list the customer's transactions before calling again, so the same amount is not applied twice. Call getLocations to list locations, or getLocation to fetch one by locationId. Call getCustomers to list valid customerRef values. Never invent UUIDs; only use values from prior tool responses.

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": {
      "transaction": "<transaction>"
    },
    "name": "deductCredits"
  }
}

Input Schema

NameRequiredDescriptionDefault
transactionYesCredits to deduct.

Output Schema

NameRequiredDescriptionDefault
transactionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedOutput schema / properties / transaction / properties / endingBalance
      Added value: +{
      +  "description": "Total credits balance of the customer right after the transaction. Not returned for transactions created before the field was introduced, or for the expiration of credits that lapsed on their expiration date.",
      +  "type": "number"
      +}
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare destructive=true and readOnly=false, and the description adds real behavior on top: FIFO consumption of soonest-expiring credits, failure on insufficient balance, and—most importantly—that each call creates a new transaction with no idempotency protection. That double-charge warning is exactly the kind of consequence an agent cannot infer from annotations.

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 operation and the expiry/deduction behavior, then standards into prerequisites and ID-handling rules. Dense but nearly every sentence carries operational weight; the trailing location/customer lookup sentences could be tightened slightly.

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?

For a destructive, nested-object mutation with an output schema, the description covers the safety-relevant behavior, failure mode, retry procedure, and reference-resolution chain. Return values are covered by the output schema, so nothing essential is missing.

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; the description earns above that by explaining that locationRef must be the customer's location and that customerRef must come from getCustomers rather than being invented. It does not document the optional description field, but the schema handles it.

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?

Opens with a specific verb+resource ("Deduct credits from a customer's credit balance") and qualifies the mode as an administrator charge, which separates it from the sibling addCredits and deductDayPasses. An agent can identify the operation without opening the schema.

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 preconditions (check balance with getCreditsBalances first, since it fails on insufficient credits) and explicit retry guidance (list transactions before retrying after a failure or timeout to avoid double-applying). It also names the lookup tools for each required reference value.

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