Skip to main content
Glama

Re-rate past usage

rerate_usage
DestructiveIdempotent

Staff only. Re-prices one consumer's, or one account's, past calls, messages, data, AI, and number or service fees for a date range, and compares them with what was charged. pricing_mode today uses the prices configured now, including a fee that was removed or set to zero. pricing_mode as_was uses the prices in effect at each usage time. pricing_mode is required except when rolling back. Omit apply to save the report without posting adjustments. Apply posts a wallet adjustment per usage item only when confirm is true and report_id is the id from that dry run. Credits an over-charge. Debits an under-charge only when debit_undercharge is true. rollback undoes those adjustments for the same report id.

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": {
      "date_from": "<date_from>",
      "date_to": "<date_to>"
    },
    "name": "rerate_usage"
  }
}

Input Schema

NameRequiredDescriptionDefault
applyNoPost the adjustments. Requires confirm and report_id.
confirmNoRequired with apply or rollback. Omitted returns the dry-run report.
date_toYesRange end, inclusive.
rollbackNoReverse adjustments posted for this report.
date_fromYesRange start, YYYY-MM-DD or ISO timestamp.
report_idNoreport_id from the saved dry run.
account_idNoAccount whose consumers are re-rated.
consumer_idNoConsumer whose usage is re-rated.
pricing_modeNotoday prices at the current rates. as_was prices at the rates in effect at each usage time. Required except for rollback.
application_idNoapplication_id from apply, used to roll back.
debit_underchargeNoWhen apply is true, also debit usage that was under-charged.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.2/5.0
Behavior5/5

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

The annotations already flag a destructive, idempotent write, and the description goes well beyond them by disclosing the dry-run-first safety model, the exact mutation (one wallet adjustment per usage item), the credit/debit direction rules, and the fact that under-charges are only debited when debit_undercharge is true. It also notes the removed-fee edge case under pricing_mode today, which an agent could not infer from the schema.

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 access restriction and the core re-pricing action are front-loaded, and each following sentence covers a distinct behavior (pricing modes, dry run, apply, rollback). It is dense and slightly run-on in the credit/debit section, with a little restatement of what the schema already says about pricing_mode.

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 an 11-parameter destructive mutation with no output schema, the description covers the full lifecycle (dry run, apply, rollback) and the charge-direction semantics an agent needs to call it safely. It stops short of describing what the saved report contains or what a successful adjustment returns, which matters given there is no output schema.

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 a baseline of 3 is warranted, but the description adds genuine meaning by explaining the coupling between apply, confirm, and report_id, and the difference between the two pricing_mode values in operational terms. Only application_id and the account/consumer mutual exclusivity are left entirely to the schema.

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?

The description opens with a specific verb ('Re-prices') and enumerates the exact resource set (calls, messages, data, AI, number/service fees) scoped to a date range, plus the comparison-to-charged framing. It does not name or differentiate against any sibling tool, so an agent must infer on its own that get_usage is the read-only counterpart.

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 explicit when-to guidance: omit apply for a dry run, set apply only with confirm and a report_id from that dry run, use rollback to reverse, and pricing_mode is required except during rollback. It does not point to any alternative tool (e.g. a read-only usage lookup) for agents who only want to inspect rather than re-rate.

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.