Skip to main content
Glama

Revenue ledger

get_revenue_ledger
Read-only

Score every campaign and creator code by the advertiser's own revenue events, not the ad network's report: spend, trials, people who actually paid, take-home revenue and payback (revenue ÷ spend). Measured, aggregated and self-reported figures are kept in separate fields; networks without per-person attribution show only an upper bound from signup answers. Campaign rows and total cover the requested days (ad platform spend, and purchases not placed on a creator code); creator rows and creatorTotal count from each creator's start date (countedFrom) and are never added into total. total includes purchases not linked to any campaign (the unattributed row); adLinkedTotal has the same spend but only campaign-linked payers and revenue, and is the figure to judge against the payback line. unattributedPayerOrigins splits the unattributed row's payers by the store of their first payment, their signup answer (selfReportedSource) and notFromChannels (channel ids whose own attribution, such as Apple AdServices answering attribution: false, said the person did not come from them, sent on any of the person's events; empty when unknown). Trials and first payments that only restore a store subscription already paid earlier (same originalTransactionId, or sent with restored: true) are not counted. Money in another currency is converted to the spend currency at the rates in fx (source live, fallback or env, with asOf); money with no known rate is left out of payback and listed in excludedRevenue, never counted as zero. paybackNullReason says why payback is null. keywords splits Apple Ads campaigns by keyword when revenue events carry the platform keyword id (keyword; keyword text from RevenueCat is placed on the campaign's one keyword with that text, and counts in unknown_keyword when several keywords share the text or the campaign's keyword list could not be read): keywords.campaigns[] has, per campaign (campaignKey = the campaign row key), keyword rows (kind keyword, keywordRef, text, matchType, taps, installs, trials, payers, revenue, payback) and one unknown_keyword row for people whose events never carried a keyword id or whose keyword text matched no single keyword (never moved onto a keyword). Each person sits in one row, so trials, payers and revenue of the keyword rows plus unknown_keyword add up to the campaign row; cost does not: keyword cost comes from Apple's keyword report for costFrom..costThrough (the campaign's first to last stored spend day, at most yesterday UTC), excludes Search Match, and is not guaranteed to sum to the campaign's cost. coverage gives the share of the campaign's payers and revenue that landed on keyword rows; when either is below 0.8 (lowCoverage), each keyword's payback is only a lower bound (paybackIsLowerBound). problem is set instead of rows when the keyword report could not be read. keywords.byText sums the same keyword text across campaigns (campaignKeys, keywordRefs); partial with excludedCampaignKeys lists Apple campaigns with spend whose keyword report was not read and so are missing from every total; the row with unreported true (text null) holds people and revenue on keyword ids that no report returned. keywords.measured is false when no event carries a keyword id; payers are then null, not zero. feed says when the workspace's own server last delivered revenue events (lastDeliveryAt, counting deliveries with no new event); counted is true when this ledger counts those events (not RevenueCat's); stale is true when counted and nothing has arrived for more than staleAfterHours (36), and the ledger then stops at lastDeliveryAt. feed is null when the server has never sent any or the delivery record could not be read. Money in (revenue) and payback are take-home: after store fees and refunds, so payback compares what the advertiser keeps with spend. Events sent before store fees (amountIsNet false) are reduced by the workspace's fee rate for their store, refunds by the same rate, before any currency conversion; amounts are shown rounded to the currency's smallest unit, payback is computed before rounding. Rows, totals, keyword rows and weeks carry takeHomeBasis (null when no event has an amount): takeHomeBasis.kind says where the take-home figure comes from: net_reported (sent after store fees), net_estimated (sent before fees, reduced by the workspace's store fee rate), net_mixed (both), gross or gross_mixed (not converted to take-home); takeHomeBasis.storeFees lists the rate used per store, isDefault true when it is Loop's default estimate (App Store 15%, Google Play 15%, Stripe 3.6%, other 0%) because the workspace set none (appProfile.storeFeeRates in PATCH /api/{workspace}/config). Taxes are not deducted, and the workspace's current rates are applied to past purchases too. storePage is the store's own product-page funnel the advertiser sends (POST /api/{workspace}/store-funnel), null when none was sent in the last 35 days (or it could not be read): not measured, never zero. windows has a 7-day and a 28-day window ending on lastReportedDate, the last day the store reported (whatever days is), each with daysReported, total and sources[] per platform and sourceType (search = App Store search, browse = App Store browse, app_referrer = another app such as Instagram or Facebook, web_referrer, other): impressions, pageViews, uniquePageViews (a sum of daily unique counts), firstDownloads, pageToDownloadRate (firstDownloads ÷ pageViews) and impressionToPageRate (pageViews ÷ impressions, search and browse only; null on total). Each rate is summed only over the days that reported both of its numbers; pageToDownloadDays and impressionToPageDays say how many, and pageToDownloadPartial / impressionToPagePartial are true when that is fewer than daysReported. A count the store did not report is null, not zero. Apple drops small cells, so every count is a lower bound and rates on low volumes are biased low. tooFewToJudge is true when the page views behind pageToDownloadRate are below minPageViews (30); such rates are shown but not judged. stale is true when lastReportedDate is more than 3 days before the ledger's end: the numbers are old (stale since lastReportedDate) and no rate is put on rows. In search and browse people can download from the results without opening the page, so pageToDownloadRate there, and on total, can be above 1.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "get_revenue_ledger"
  }
}

Input Schema

NameRequiredDescriptionDefault
daysNoWindow in days ending today (UTC). Defaults to 28.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A3.6/5.0
Behavior5/5

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

Beyond the readOnly and non-destructive annotations, the description discloses extensive behavioral detail: attribution rules, null-versus-zero semantics, stale feed handling, currency conversion and exclusions, take-home fee treatment, keyword coverage thresholds, and upper-bound limitations. This is unusually rich context that materially affects interpretation of the returned data.

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

Conciseness2/5

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

The description is an enormous single block of densely packed sentences with semicolons and nested clauses, making it hard to scan. Much of the domain detail is relevant, but the lack of headings, paragraphing, or prioritization makes it poorly structured and far longer than needed for a one-parameter read tool.

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?

There is no output schema, so the description carries the full burden of explaining return semantics, and it does so exhaustively: row scopes, totals, keyword rows, coverage, feed staleness, take-home basis, and null behavior are all covered. An agent has enough context to interpret the ledger correctly despite its complexity.

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

Parameters3/5

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

Schema coverage is 100%, so the days parameter is already fully documented by the input schema, including its default of 28. The description references 'requested days' and 'whatever days is' but adds no meaningful interpretation or constraints beyond what the schema already provides, making the baseline score of 3 appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the resource and verb: scoring campaigns and creator codes using advertiser-side revenue events, including spend, trials, payers, take-home revenue, and payback. It is specific about what the ledger contains, but it never explicitly distinguishes itself from the sibling get_revenue_diagnosis or other revenue-related tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

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

There is no explicit when-to-use or when-not-to-use guidance, and no named alternative is suggested. The only implied usage is the mention of 'requested days' and the default window, so an agent must infer when this ledger is preferable to get_revenue_diagnosis or get_overview.

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