@fload-ai/mcp 0.12.2 → 0.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -554,6 +554,38 @@ async function translateReview(input, client) {
554
554
 
555
555
  // src/tools/analytics.ts
556
556
  import { z as z3 } from "zod";
557
+ function unavailableReasonValue(reason) {
558
+ if (reason.cause === "not_reported") return "not_reported";
559
+ const hiddenByCause = reason.cause === "filtered_out" || reason.cause === "not_by_dimension";
560
+ if (reason.reason === "source_filter" || hiddenByCause) {
561
+ return "source_filter";
562
+ }
563
+ return "no_data";
564
+ }
565
+ function unavailableReason(name, meta) {
566
+ if (!(meta.unavailableMetrics ?? []).includes(name)) return void 0;
567
+ const reason = meta.unavailableMetricReasons?.[name];
568
+ return {
569
+ reason: reason ? unavailableReasonValue(reason) : "no_data",
570
+ message: reason?.message ?? "Unavailable for this query."
571
+ };
572
+ }
573
+ function unavailableEntries(requested, data, meta) {
574
+ return requested.flatMap((name) => {
575
+ const unavailable = unavailableReason(name, meta);
576
+ if (!unavailable || name in data) return [];
577
+ return [
578
+ {
579
+ name,
580
+ displayName: METRIC_INFO[name]?.displayName || name,
581
+ type: METRIC_INFO[name]?.type || "count",
582
+ summary: null,
583
+ change: null,
584
+ unavailable
585
+ }
586
+ ];
587
+ });
588
+ }
557
589
  function summarize(points, change) {
558
590
  const values = (Array.isArray(points) ? points : []).map((point) => point.value ?? point.total).filter((value) => typeof value === "number");
559
591
  return {
@@ -786,16 +818,25 @@ async function getMetrics(input, client) {
786
818
  dateRange: { start: startDate, end: endDate },
787
819
  granularity,
788
820
  dimension: input.dimension || null,
789
- metrics: Object.keys(data).map((name) => ({
790
- name,
791
- displayName: info[name]?.displayName || name,
792
- type: info[name]?.type || "count",
793
- summary: summaries[name],
794
- change: changes[name] || null,
795
- ...input.dimension && {
796
- breakdown: summaryResponse.breakdownTotals?.[name] ?? null
797
- }
798
- })),
821
+ metrics: [
822
+ ...Object.keys(data).map((name) => ({
823
+ name,
824
+ displayName: info[name]?.displayName || name,
825
+ type: info[name]?.type || "count",
826
+ summary: summaries[name],
827
+ change: changes[name] || null,
828
+ ...input.dimension && {
829
+ breakdown: summaryResponse.breakdownTotals?.[name] ?? null
830
+ },
831
+ // A computed metric the API marks unavailable comes back as an
832
+ // empty series: it carries its reason too.
833
+ ...unavailableReason(name, meta) && {
834
+ unavailable: unavailableReason(name, meta)
835
+ }
836
+ })),
837
+ // FLO-2840: listed with the reason, never dropped or 0.
838
+ ...unavailableEntries(input.metrics, data, meta)
839
+ ],
799
840
  timeseries: data,
800
841
  meta
801
842
  })
@@ -2171,7 +2212,7 @@ function registerTools(server, client, options = {}) {
2171
2212
  tool(
2172
2213
  "send_review_reply",
2173
2214
  "Send review reply",
2174
- "Send a reply to an app review on the App Store or Google Play. The response text will be submitted as the developer response. This is a write operation that publishes the reply publicly \u2014 treat as destructive (cannot be silently undone).",
2215
+ "Send a reply to an app review on the App Store or Google Play. The response text will be submitted as the developer response. This is a write operation that publishes the reply publicly \u2014 treat as destructive (cannot be silently undone). Needs the write:reviews and write:agents (Approve and run) permissions, as approving a reply in the inbox does.",
2175
2216
  sendReviewReplySchema,
2176
2217
  sendReviewReply,
2177
2218
  { readOnlyHint: false, destructiveHint: true, openWorldHint: true }
@@ -2195,7 +2236,7 @@ function registerTools(server, client, options = {}) {
2195
2236
  tool(
2196
2237
  "get_metrics",
2197
2238
  "Get metrics",
2198
- "Query metric timeseries data for an app. Supports 30+ metrics (proceeds, totalDownloads, activeSubs, sessions, crashes, adSpend, adAvgCPA, etc.). Can query multiple metrics at once. Supports dimensional breakdowns (by country, platform, campaign). Each metric's summary.value is its value over the period, aggregated the right way for that metric: summed for flows like downloads, the latest value for levels like active subscriptions, and total over total for ratios like CPA. It covers summary.effectiveFromDate to summary.effectiveToDate: the requested days, less recent days whose data is not complete yet. Quote summary.value with that range rather than adding up the points. Use discover_metrics first to see available metrics.",
2239
+ "Query metric timeseries data for an app. Supports 30+ metrics (proceeds, totalDownloads, activeSubs, sessions, crashes, adSpend, adAvgCPA, etc.). Can query multiple metrics at once. Supports dimensional breakdowns (by country, platform, campaign). Each metric's summary.value is its value over the period, aggregated the right way for that metric: summed for flows like downloads, the latest value for levels like active subscriptions, and total over total for ratios like CPA. It covers summary.effectiveFromDate to summary.effectiveToDate: the requested days, less recent days whose data is not complete yet. Quote summary.value with that range rather than adding up the points. A requested metric the API could not report, on a total or a breakdown read, is listed with summary null and unavailable {reason, message}: reason not_reported means none of the app's connected sources has ever sent it (say it is not reported); no_data means nothing in this window; source_filter means a source filter, a dimension filter or the breakdown's dimension hides it (the metric has no rows split that way). Never quote it as 0. Use discover_metrics first to see available metrics.",
2199
2240
  getMetricsSchema,
2200
2241
  getMetrics,
2201
2242
  { readOnlyHint: true, openWorldHint: false }
@@ -2421,7 +2462,7 @@ function registerTools(server, client, options = {}) {
2421
2462
  }
2422
2463
 
2423
2464
  // src/version.ts
2424
- var FLOAD_MCP_VERSION = "0.12.2";
2465
+ var FLOAD_MCP_VERSION = "0.12.4";
2425
2466
 
2426
2467
  // src/server.ts
2427
2468
  async function createMcpServer(_config, client) {