Skip to main content
Glama

Get billed product revenue

well_get_stripe_product_revenue
Read-only

Read billed Stripe invoice-line revenue by product over a half-open issue-date window. Revenue is the sum of eligible issued invoice lines, not cash received or margin. The read preserves separate currency totals and never converts currencies. Lines with a price but no live product are in unknown_price_totals; lines with no Stripe price and no live product are in no_price_totals. These buckets stay unattributed. total_sales_by_currency is the complete denominator for the returned scope, including both buckets. Each product total has share_of_total_percent calculated from that denominator in percentage points with two decimals (90.16 means 90.16%); the share is null when the denominator is unavailable or zero. Product identity is the public product UUID, so two products with the same name remain separate. Product totals combine monthly and yearly variants for the same product and currency; product_intervals keeps those detail rows. No ordering or ranking is implied by this tool.

Pass from as the first issue date to include and to as the first issue date to exclude, both YYYY-MM-DD and no more than 366 days apart. scope defaults to this workspace. Pass all_my_workspaces for an unqualified WhatsApp question and whenever the person asks across their workspaces. Each workspace stays labeled. Global totals combine only connected workspaces with readable successful data. A workspace with no live Stripe connection stays named in its workspace block, is excluded from global totals, and does not block totals from connected workspaces. Global totals are null when a workspace is omitted, unreadable, incomplete, failed, unknown, or when no connected workspace has readable data; the workspace block reports that state instead of returning a zero. A processing connector with prior successful data is included and labeled refreshing; its sync_notice says a Stripe sync is running, figures may still move, and includes the last successful sync timestamp. A first sync without prior successful data stays unknown. The result includes no provider call.

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

NameRequiredDescriptionDefault
toYesFirst issue date to exclude, YYYY-MM-DD.
fromYesFirst issue date to include, YYYY-MM-DD.
scopeNoRead this workspace alone or all_my_workspaces across the authorized real workspaces of the signed-in person. Use all workspaces for an unqualified WhatsApp question and when the person asks across their workspaces.
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.

Output Schema

NameRequiredDescriptionDefault
toNo
fromNo
errorNo
scopeNo
successYes
workspacesNo
product_totalsNo
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.
no_price_totalsNo
resolved_workspaceNoThe workspace that answered, when the caller named none and the token authorizes several.
conversation_id_noteNoPresent only when the server opened a fresh lane, stating that no choice recorded earlier was read.
unknown_price_totalsNo
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.
total_sales_by_currencyNo
all_workspaces_product_totalsNo
all_workspaces_no_price_totalsNo
all_workspaces_unknown_price_totalsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed14 schema fields changed
    • changedOutput schema / properties / all_workspaces_product_totals / anyOf
      Previous value: -[
      -  {
      -    "items": {
      -      "additionalProperties": false,
      -      "properties": {
      -        "currency": {
      -          "type": "string"
      -        },
      -        "line_count": {
      -          "type": "number"
      -        },
      -        "product_id": {
      -          "format": "uuid",
      -          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
      -          "type": "string"
      -        },
      -        "product_name": {
      -          "type": "string"
      -        },
      -        "share_of_total_percent": {
      -          "anyOf": [
      -            {
      -              "type": "string"
      -            },
      -            {
      -              "type": "null"
      -            }
      -          ],
      -          "description": "Percent points with two decimals, or null when the denominator is unavailable or zero."
      -        },
      -        "total": {
      -          "type": "string"
      -        },
      -        "workspace_count": {
      -          "type": "number"
      -        }
      -      },
      -      "required": [
      -        "product_id",
      -        "product_name",
      -        "currency",
      -        "line_count",
      -        "total",
      -        "share_of_total_percent",
      -        "workspace_count"
      -      ],
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "items": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "currency": {
      +          "type": "string"
      +        },
      +        "line_count": {
      +          "type": "number"
      +        },
      +        "product_id": {
      +          "format": "uuid",
      +          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
      +          "type": "string"
      +        },
      +        "product_name": {
      +          "type": "string"
      +        },
      +        "share_of_total_percent": {
      +          "description": "Percent points with two decimals, or null when the denominator is unavailable or zero.",
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        },
      +        "total": {
      +          "type": "string"
      +        },
      +        "workspace_count": {
      +          "type": "number"
      +        }
      +      },
      +      "required": [
      +        "product_id",
      +        "product_name",
      +        "currency",
      +        "line_count",
      +        "total",
      +        "share_of_total_percent",
      +        "workspace_count"
      +      ],
      +      "type": "object"
      +    },
      +    "type": "array"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedOutput schema / properties / product_totals / anyOf
      Previous value: -[
      -  {
      -    "items": {
      -      "additionalProperties": false,
      -      "properties": {
      -        "currency": {
      -          "type": "string"
      -        },
      -        "line_count": {
      -          "type": "number"
      -        },
      -        "product_id": {
      -          "format": "uuid",
      -          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
      -          "type": "string"
      -        },
      -        "product_name": {
      -          "type": "string"
      -        },
      -        "share_of_total_percent": {
      -          "anyOf": [
      -            {
      -              "type": "string"
      -            },
      -            {
      -              "type": "null"
      -            }
      -          ],
      -          "description": "Percent points with two decimals, or null when the denominator is unavailable or zero."
      -        },
      -        "total": {
      -          "type": "string"
      -        }
      -      },
      -      "required": [
      -        "product_id",
      -        "product_name",
      -        "currency",
      -        "line_count",
      -        "total",
      -        "share_of_total_percent"
      -      ],
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "items": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "currency": {
      +          "type": "string"
      +        },
      +        "line_count": {
      +          "type": "number"
      +        },
      +        "product_id": {
      +          "format": "uuid",
      +          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
      +          "type": "string"
      +        },
      +        "product_name": {
      +          "type": "string"
      +        },
      +        "share_of_total_percent": {
      +          "description": "Percent points with two decimals, or null when the denominator is unavailable or zero.",
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        },
      +        "total": {
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "product_id",
      +        "product_name",
      +        "currency",
      +        "line_count",
      +        "total",
      +        "share_of_total_percent"
      +      ],
      +      "type": "object"
      +    },
      +    "type": "array"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedOutput schema / properties / resolved_workspace / properties / name / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / resolved_workspace / properties / name / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / workspaces / items / properties / last_successful_sync_at / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / workspaces / items / properties / last_successful_sync_at / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / workspaces / items / properties / latest_sync_status / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / workspaces / items / properties / latest_sync_status / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / workspaces / items / properties / product_intervals / items / properties / billing_interval / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / workspaces / items / properties / product_intervals / items / properties / billing_interval / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / workspaces / items / properties / product_totals / items / properties / share_of_total_percent / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / workspaces / items / properties / product_totals / items / properties / share_of_total_percent / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / workspaces / items / properties / workspace_name / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / workspaces / items / properties / workspace_name / type
      Added value: +[
      +  "string",
      +  "null"
      +]
  2. Changed5 schema fields changed
    • addedOutput schema / properties / all_workspaces_no_price_totals
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "additionalProperties": false,
      +        "description": "Billed lines with no Stripe price id and no live product in this workspace.",
      +        "properties": {
      +          "currency": {
      +            "type": "string"
      +          },
      +          "line_count": {
      +            "type": "number"
      +          },
      +          "total": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "currency",
      +          "line_count",
      +          "total"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • addedOutput schema / properties / no_price_totals
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "additionalProperties": false,
      +        "description": "Billed lines with no Stripe price id and no live product in this workspace.",
      +        "properties": {
      +          "currency": {
      +            "type": "string"
      +          },
      +          "line_count": {
      +            "type": "number"
      +          },
      +          "total": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "currency",
      +          "line_count",
      +          "total"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • addedOutput schema / properties / workspaces / items / properties / no_price_totals
      Added value: +{
      +  "items": {
      +    "additionalProperties": false,
      +    "description": "Billed lines with no Stripe price id and no live product in this workspace.",
      +    "properties": {
      +      "currency": {
      +        "type": "string"
      +      },
      +      "line_count": {
      +        "type": "number"
      +      },
      +      "total": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "currency",
      +      "line_count",
      +      "total"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / workspaces / items / properties / sync_notice
      Added value: +{
      +  "description": "A reply line for a refresh in progress, including the last successful sync timestamp.",
      +  "type": "string"
      +}
    • changedOutput schema / properties / workspaces / items / required
      Previous value: -[
      -  "workspace_id",
      -  "workspace_name",
      -  "state",
      -  "unknown_reason",
      -  "product_totals",
      -  "product_intervals",
      -  "unknown_price_totals",
      -  "total_sales_by_currency",
      -  "last_successful_sync_at",
      -  "latest_sync_status",
      -  "connector_coverage"
      -]New value: +[
      +  "workspace_id",
      +  "workspace_name",
      +  "state",
      +  "unknown_reason",
      +  "product_totals",
      +  "product_intervals",
      +  "unknown_price_totals",
      +  "no_price_totals",
      +  "total_sales_by_currency",
      +  "last_successful_sync_at",
      +  "latest_sync_status",
      +  "connector_coverage"
      +]
  3. Added

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already cover the safety profile (readOnlyHint, destructiveHint=false, openWorldHint=false), so the bar is lower, yet the description still adds substantial behavior: no currency conversion, unattributed buckets that stay unattributed, null share when the denominator is zero or missing, null versus zero global totals for omitted/unreadable/failed workspaces, and how a 'refreshing' connector is labeled mid-sync. It even states there is no provider call, which an agent cannot get from the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The first sentence is a model of front-loading, but the body sprawls across five dense paragraphs, and the closing paragraph repeats the workspace_id rule already stated two paragraphs earlier and in the schema. Substantive material is mixed with repetition, so the agent must read the whole block to extract the operative constraints.

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?

For a six-parameter, multi-workspace aggregation tool with an output schema, this covers everything an agent needs: denominator definition, unattributed bucket handling, percentage precision, product identity being the UUID rather than the name, and the connector-state edge cases that determine whether totals are null. Nothing required to call it correctly is missing.

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 the baseline is 3, and the description clears it by adding constraints the schema lacks: the window is half-open, `from` and `to` may be no more than 366 days apart, and the workspace_id decision rule (omit for one workspace, required for several) is spelled out as a behavioral requirement rather than a field note. The conversation_id and workspace_scope passages largely restate their schema descriptions, which keeps it out of 5 territory.

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 opening sentence gives a specific verb, resource, grain and scope: 'Read billed Stripe invoice-line revenue by product over a half-open issue-date window,' and it immediately rules out the nearest confusions ('not cash received or margin'). An agent can tell this apart from product-catalog tools like well_get_product and from the measure/render siblings 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 Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives concrete routing conditions: call directly when the token authorizes one workspace, pass workspace_id when it authorizes several, and use all_my_workspaces for an unqualified WhatsApp or cross-workspace question. What it never does is name a sibling alternative (e.g. well_get_figure or the well_measure_* family), so the agent must infer when another revenue tool would be preferable.

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