Skip to main content
Glama

Moltline Merchant Math

Discount Stack

discount_stack
Read-onlyIdempotent

Stack discounts correctly: sequential vs additive comparison. PREMIUM (license).

The two methods differ — this shows both, the final price, and the true total discount. Typical input {"price": 200, "discounts_pct": [20, 10]} returns {"original": 200, "sequential_price": 144.0, "sequential_total_discount_pct": 28.0, "additive_price": 140.0, "difference": 4.0, "note": "..."}.

Use when more than one discount applies and the order changes the answer. Not for a single discount inside an invoice (invoice_total). Errors: on invalid, missing, or malformed input this tool never raises a protocol error — it returns {"error": ""} (for example {"error": "price > 0 and at least one discount required"}). Every call is read-only and idempotent, so after correcting the input it is always safe to retry.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
priceYesOriginal price before discounts; must be greater than 0.
discounts_pctYesDiscount percentages in the order applied, at least one, e.g. [20, 10] for 20% then 10%.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint. The description adds error-handling behavior (returns error object, never protocol error) and explicitly states read-only/idempotent retry safety, enhancing transparency beyond 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 description is multi-sentence but well-structured: purpose, example, usage guidance, error behavior, and safety note all contribute. It is not bloated; each sentence serves a distinct function.

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?

The tool has a simple schema, strong annotations, and an output schema, yet the description still explains return values, error cases, and usage boundaries, making it self-contained. No critical information is missing for an agent to select and invoke it correctly.

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 covers 100% of parameters, so baseline is 3. The description adds a concrete example mapping inputs to outputs and clarifies ordering semantics for discounts_pct, which strengthens understanding beyond the raw schema.

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 uses specific verbs ('stack discounts', 'sequential vs additive comparison') and clearly states the tool's scope: computing both methods, final price, and true total discount. It also differentiates from sibling invoice_total by explicitly excluding single-discount invoice scenarios.

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?

Explicitly states when to use: 'Use when more than one discount applies and the order changes the answer.' Includes an exclusion: 'Not for a single discount inside an invoice (invoice_total),' naming the alternative. Also flags PREMIUM license.

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.

TDQS

A4.6/5.0
Disambiguation4/5

Each tool targets a distinct calculation scenario (fees, discounts, installments, invoicing, proration). The descriptions explicitly state when to use each and when not to, reducing ambiguity. Minor overlap exists between processor_fees and charge_to_net, but the inverse relationship is clearly documented.

Naming Consistency5/5

All tool names use a consistent noun_verb pattern (e.g., charge_to_net, discount_stack, installment_plan). The naming is descriptive and follows a predictable structure, making it easy for an agent to infer tool purpose from the name alone.

Tool Count5/5

With 6 tools, the count is ideal for the domain of merchant math. Each tool covers a distinct and essential calculation type without redundancy, and the scope is neither too thin nor overly heavy.

Completeness4/5

The tools cover core merchant math operations: fee calculation, gross-up pricing, discount stacking, installment splitting, invoicing, and proration. A minor gap is the absence of a tool for compound interest or tax-only calculations, but those may be out of scope for merchant math. Overall, the surface is well-rounded for its intended domain.

Resources