Skip to main content
Glama

Render the customer lifetime value ranking

well_render_customer_ltv
Read-only

Draw the customer lifetime value (LTV) ranking as a bar chart card: one bar per customer, the highest first.

Call it once, after well_measure_customer_ltv, and send no figure. It runs the measure itself for the workspace of the call and draws that result, so every name, flag and LTV on the card is the server's. You pass only: window and counterparty_alias_sets exactly as you passed them to the measure, the currency the card draws, left_off_currencies and conversions. Read the figures for your answer from the measure's result, not from this tool's. Do not call it when the measure returned no row: say there is nothing to rank instead.

One currency per card. Set currency to the currency the card draws. Every other currency in the measure's currencies goes in exactly one of two places. Convert it: add a conversions entry with the rate into currency and its date, from the currency conversion step, and the tool applies it to each customer's LTV. Or leave it off: name it in left_off_currencies, which keeps its customers off the card, because Well has no rate for it or because converting it is not allowed. The card's own currency is never converted and never left off. A card that converts draws only when no currency on it, the card's own currency included, has more than 100 customers, because the measure cuts rows past that. Otherwise draw the card's own currency alone and name the others in left_off_currencies.

The card draws at most 12 customers, never a summed "other" bar, and its small form quotes the average LTV per customer. The result states average_ltv, customer_count (the customers the average covers) and left_out_count (customers not drawn): say how many customers the card leaves out when it is above zero.

REFUSED rather than drawn:

  • a window that reaches the running month or covers more than 60 months

  • a measured currency that is neither converted nor left off, or a currency the measure did not find

  • the card's own currency in left_off_currencies or in conversions

  • a rate more than 1% away from Well's stored rate for the pair on its rate date, a rate dated outside the window's last complete month, or two rates for one currency

  • a card that converts when the measure cut rows from a currency on it

Because the measure runs again here, a ranking reads the invoices twice. That is by design: it is what ties the card to the server's figures.

When party_scope.side_unknown is true the workspace has no resolved own company, so no side filter was applied and the ranking covers invoices on both sides. Say the side is unknown, never that these are the customers' figures.

When the token authorizes one workspace, call this directly — no workspace call is needed first. When it authorizes several, this read will not guess which one you mean: pass workspace_id on the call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
windowYesThe window the measure read, unchanged: `from` inclusive, `to` exclusive, both YYYY-MM-01.
currencyYesThe one currency the card draws.
conversionsYesOne rate for each measured currency the card converts into its own.
workspace_idNoTarget workspace. Omit when the token authorizes one workspace. Required when it authorizes several: this read reports one workspace's own figures and will not choose which.
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.
left_off_currenciesYesThe measured currencies the card does not draw. Their customers are not on the card.
counterparty_alias_setsNoThe alias sets passed to the measure, unchanged. Omit when the measure had none.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
ruleYes
windowYes
entriesYes
partialYes
successYes
currencyYes
portfolioYes
average_ltvYes
computed_byYes
conversionsYes
party_scopeYesWhat the receivable side resolved to. `side_unknown: true` means the workspace resolved no own company, so NO side filter was applied (`applied: false`) and the ranking covers invoices on both sides — say the side is unknown, never that these are the customers' figures. `null` when no read reported a scope resolution.
young_countYes
customer_countYes
left_out_countYes
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.
omitted_row_countYes
resolved_workspaceNoThe workspace that answered, when the caller named none and the token authorizes several.
left_off_currenciesYes
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.
omitted_drawn_row_countYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedOutput schema / properties / newly_connected / description
      Previous value: -"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. Start the reply with 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."New value: +"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."
    • addedOutput schema / properties / party_scope
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": false,
      +      "properties": {
      +        "applied": {
      +          "type": "boolean"
      +        },
      +        "requested": {
      +          "enum": [
      +            "purchase",
      +            "sales",
      +            "intra_self",
      +            "unattributed"
      +          ],
      +          "type": "string"
      +        },
      +        "side_unknown": {
      +          "type": "boolean"
      +        }
      +      },
      +      "required": [
      +        "requested",
      +        "applied",
      +        "side_unknown"
      +      ],
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "description": "What the receivable side resolved to. `side_unknown: true` means the workspace resolved no own company, so NO side filter was applied (`applied: false`) and the ranking covers invoices on both sides — say the side is unknown, never that these are the customers' figures. `null` when no read reported a scope resolution."
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "window",
      -  "currency",
      -  "entries",
      -  "average_ltv",
      -  "customer_count",
      -  "left_out_count",
      -  "young_count",
      -  "portfolio",
      -  "conversions",
      -  "left_off_currencies",
      -  "rule",
      -  "omitted_row_count",
      -  "omitted_drawn_row_count",
      -  "partial",
      -  "computed_by",
      -  "success"
      -]New value: +[
      +  "window",
      +  "currency",
      +  "entries",
      +  "average_ltv",
      +  "customer_count",
      +  "left_out_count",
      +  "young_count",
      +  "portfolio",
      +  "conversions",
      +  "left_off_currencies",
      +  "rule",
      +  "omitted_row_count",
      +  "omitted_drawn_row_count",
      +  "partial",
      +  "party_scope",
      +  "computed_by",
      +  "success"
      +]
  2. Changed1 schema field changed
    • addedInput schema / properties / workspace_scope
      Added value: +{
      +  "description": "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.",
      +  "enum": [
      +    "family"
      +  ],
      +  "type": "string"
      +}
  3. Changed1 schema field changed
    • addedOutput schema / properties / newly_connected
      Added value: +{
      +  "description": "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. Start the reply with 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.",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "name": {
      +        "type": "string"
      +      },
      +      "service_id": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "name",
      +      "service_id"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
  4. Added

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources