Skip to main content
Glama

Compute figures

well_get_computed_figures
Read-only

Call this for any sum, difference, product, ratio, comparison, ranking or count of days over money, quantities or dates: never compute one yourself, because Well computes with exact decimals and your own arithmetic drifts.

Every operand is an input or earlier-step name. Every amount is a quoted decimal string, never a JSON number. Example: {"inputs":[{"name":"a","label":"A","amount":"1","currency":"GBP"},{"name":"b","label":"B","amount":"2","currency":"GBP"}],"steps":[{"id":"total","op":"sum","args":["a","b"]}]}. Label constants (0, 1, rates) as inputs.

take_until_total_reaches: args: [target], order (latest_due_first/largest_first), items naming amount and date inputs. sum_picked: per_item for every pick item exactly once, keyed by amount input name; sums picked items only.

div and round require places (0-12) and rounding: half_up, half_even or down. compare requires relation.

A total that Well measures (spend, invoices, receivables, payslips) comes from its well_sum_* tool. This tool only combines figures already read, and it never reads data.

sum/sub/min/max/compare/take_until_total_reaches: one currency throughout or none. sum_picked: the per_item values share one currency, or none. mul: at most one currency. div: currency over untagged amount keeps currency; equal currencies give an untagged ratio.

invalid_program: bad program. duplicate_name. unknown_reference: missing/forward. wrong_type. mixed_currency: mismatch. division_by_zero: zero divisor. out_of_range: too large. invalid_date: bad day.

Quote each returned figure as given.

Input Schema

NameRequiredDescriptionDefault
stepsYes
inputsYes
workspace_idNoTarget workspace. Optional: this tool describes the token itself rather than one workspace's data, so omitting it returns the same answer.
conversation_idNoThe conversation id returned by the previous Well result, in its meta under well/conversation_id, in its structuredContent, or in its JSON text block. Pass it back on every call in the same conversation, including a call a card makes, so the chosen workspace and the earlier answers still apply. It decides the conversation on its own: nothing the host states about the session replaces it. Omit it only on the first call of a conversation.
workspace_scopeNoRestrict this call to the family: the token's primary workspace plus the company workspaces under it that you are a member of. Unrelated authorized workspaces drop out of the read; row reads merge across the family, while a per-workspace figure still reports exactly one workspace.

Output Schema

NameRequiredDescriptionDefault
stepNo
errorNo
figuresNo
successYes
error_reasonNo
conversation_idNoThe conversation this result belongs to. Pass it back as the conversation_id argument on every later Well call in the same conversation.
newly_connectedNoTools that connected to this workspace since the last result and that no session was told about yet, oldest first. Present only when at least one tool is new. The connected-line rule says when to tell an entry; when it does, one line per entry, in the person's language: "<name> is connected.". Never fold several entries into one sentence. Each entry comes back once, on one result only: never repeat its line later.
conversation_id_noteNoPresent only when the server opened a fresh lane, stating that no choice recorded earlier was read.
conversation_id_sourceNoWhere the conversation id came from: the host's own request meta, the caller's argument, or a fresh lane the server opened.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • removedOutput schema / properties / figures / items / properties / value / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "boolean"
      -  }
      -]
    • addedOutput schema / properties / figures / items / properties / value / type
      Added value: +[
      +  "string",
      +  "boolean"
      +]
  2. Changed3 schema fields changed
    • removedInput schema / properties / inputs / items / properties / label / pattern
      Removed value: -"^[^\\p{Cc}\\p{Cf}]*$"
    • removedInput schema / properties / steps / items / properties / items / items / properties / label / pattern
      Removed value: -"^[^\\p{Cc}\\p{Cf}]*$"
    • removedInput schema / properties / steps / items / properties / label / pattern
      Removed value: -"^[^\\p{Cc}\\p{Cf}]*$"
  3. Added

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnly/non-destructive/non-open-world, yet the description still adds substantive behavior: exact-decimal arithmetic as the reason for existing, an explicit no-data-read boundary, per-operator currency propagation rules, and a full failure taxonomy (`invalid_program`, `mixed_currency`, `division_by_zero`, etc.). The closing 'Quote each returned figure as given' also constrains how the agent must relay output.

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 imperative 'Call this for any sum ...' and organized into short thematic paragraphs, so it scans well for its length. A few lines are filler, though — 'invalid_program: bad program' restates itself and 'wrong_type' needs no gloss — so it is dense rather than maximally economical.

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 nested expression-program tool this is close to complete: the currency algebra, error codes, and step-reference model are all covered, and an output schema means return values need no prose. What is left implicit is the arity/operand layout for the remaining operators (`abs`, `days_between`, `add_days`, `min`/`max`), which an agent must infer from the enum plus one example.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

At 60% schema coverage the description carries the semantic load and does: amounts must be quoted decimal strings rather than JSON numbers, constants must be labeled as inputs, `args` are references to inputs or earlier step ids, and the non-obvious operator contracts (`take_until_total_reaches` with `args: [target]`/`order`/`items`, `sum_picked`'s `per_item` keyed by amount input name, `div`/`round` requiring `places` and `rounding`, `compare` requiring `relation`) are all spelled out. The worked JSON example pins the whole structure down.

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 first sentence names concrete operations (sum, difference, product, ratio, comparison, ranking, day counts) over a named resource domain, and the fifth paragraph explicitly separates it from the `well_sum_*` family: 'A total that Well measures ... comes from its `well_sum_*` tool. This tool only combines figures already read, and it never reads data.' An agent can pick between this and a `well_sum_*` sibling without opening any 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?

It states both when to use ('Call this for any sum ... never compute one yourself') and when not to, naming the alternative tool family and the condition that routes to it. It also gives a concrete prerequisite — operands must be inputs or earlier-step names — which is exactly the kind of pre-call context an agent needs.

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