Skip to main content
Glama

Pressmark

Calculate Document Totals

calculate_totals
Read-onlyIdempotent

Statelessly compute subtotal, tax, discount, grand total, and balance due for a document payload without mutating server records. Example: calculate_totals({"document":{"items":[{"quantity":2,"unit_price":50}]}})

Input Schema

NameRequiredDescriptionDefault
documentYesInput document JSON payload containing items, tax_rate, discount_amount, and optional amount_paid.

Output Schema

NameRequiredDescriptionDefault
is_paidYesTrue when balance_due is zero.
subtotalYesSum of line item amounts before tax and document discount.
tax_totalYesCalculated tax amount.
amount_paidYesAmount already paid toward the document.
balance_dueYesRemaining unpaid balance due.
grand_totalYesTotal amount payable after tax and discount.
discount_amountYesDocument-level discount applied.

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 already declare readOnly, idempotent, non-destructive and closed-world, so the safety profile is covered; the description reinforces it with 'statelessly' and 'without mutating server records.' It adds no detail on precision/rounding or how partial payloads are handled, which are the remaining behavioral unknowns for a calculation tool.

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?

Two sentences: the capability and its scope first, a compact worked example second. Nothing is redundant with the annotations or title, and the example is directly load-bearing.

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?

An output schema exists so return values need not be described, annotations cover the mutation profile, and the example disambiguates the single nested parameter. What's left unexplained is the semantic convention for tax_rate (rate vs percentage) and rounding — the main source of mis-invocation for a totals calculator.

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 baseline would be 3; the inline example goes beyond the schema by revealing the internal shape of the nested document, including field names inside items (quantity, unit_price) that the schema never documents. It does not show how tax_rate or discount_amount are expressed, so it falls short of 5.

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?

Names a specific verb (compute) plus an enumerated set of outputs (subtotal, tax, discount, grand total, balance due) scoped to a document payload. The phrase 'statelessly ... without mutating server records' separates it from mutating siblings like record_payment and generate_document.

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?

The stateless/no-mutation framing makes the intended context clear: use it when totals are needed for a preview or validation without persisting anything. It stops short of naming an explicit alternative or exclusion rule (e.g. 'use record_payment when you intend to settle the balance').

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.