Compute figures
well_get_computed_figuresCall 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
| Name | Required | Description | Default |
|---|---|---|---|
| steps | Yes | ||
| inputs | Yes | ||
| workspace_id | No | Target workspace. Optional: this tool describes the token itself rather than one workspace's data, so omitting it returns the same answer. | |
| conversation_id | No | The 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_scope | No | Restrict 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
| Name | Required | Description | Default |
|---|---|---|---|
| step | No | ||
| error | No | ||
| figures | No | ||
| success | Yes | ||
| error_reason | No | ||
| conversation_id | No | The conversation this result belongs to. Pass it back as the conversation_id argument on every later Well call in the same conversation. | |
| newly_connected | No | Tools 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_note | No | Present only when the server opened a fresh lane, stating that no choice recorded earlier was read. | |
| conversation_id_source | No | Where the conversation id came from: the host's own request meta, the caller's argument, or a fresh lane the server opened. |