@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.
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import type { FloadApiClient } from '../api-client.js';
3
+ export declare const UNAVAILABLE_REASONS: readonly ["not_reported", "no_data", "source_filter"];
3
4
  export declare const discoverMetricsSchema: z.ZodObject<{
4
5
  assetId: z.ZodString;
5
6
  }, z.core.$strip>;
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/tools/analytics.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAuGvD,eAAO,MAAM,qBAAqB;;iBAKhC,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;iBAgC3B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;iBAQnC,CAAC;AAmIH,wBAAsB,eAAe,CACnC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,EAC5C,MAAM,EAAE,cAAc;;;;;;;;;;;;GA8CvB;AAED,wBAAsB,UAAU,CAC9B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,EACvC,MAAM,EAAE,cAAc;;;;;;;;;;;;GAyFvB;AAED,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,EAC/C,MAAM,EAAE,cAAc;;;;;;;;;;;;GAuDvB"}
1
+ {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/tools/analytics.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA+EvD,eAAO,MAAM,mBAAmB,uDAItB,CAAC;AAgGX,eAAO,MAAM,qBAAqB;;iBAKhC,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;iBAgC3B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;iBAQnC,CAAC;AAmIH,wBAAsB,eAAe,CACnC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,EAC5C,MAAM,EAAE,cAAc;;;;;;;;;;;;GA8CvB;AAED,wBAAsB,UAAU,CAC9B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,EACvC,MAAM,EAAE,cAAc;;;;;;;;;;;;GAkGvB;AAED,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,EAC/C,MAAM,EAAE,cAAc;;;;;;;;;;;;GAuDvB"}
@@ -402,6 +402,43 @@ async function translateReview(input, client) {
402
402
 
403
403
  // src/tools/analytics.ts
404
404
  import { z as z3 } from "zod";
405
+ var UNAVAILABLE_REASONS = [
406
+ "not_reported",
407
+ "no_data",
408
+ "source_filter"
409
+ ];
410
+ function unavailableReasonValue(reason) {
411
+ if (reason.cause === "not_reported") return "not_reported";
412
+ const hiddenByCause = reason.cause === "filtered_out" || reason.cause === "not_by_dimension";
413
+ if (reason.reason === "source_filter" || hiddenByCause) {
414
+ return "source_filter";
415
+ }
416
+ return "no_data";
417
+ }
418
+ function unavailableReason(name, meta) {
419
+ if (!(meta.unavailableMetrics ?? []).includes(name)) return void 0;
420
+ const reason = meta.unavailableMetricReasons?.[name];
421
+ return {
422
+ reason: reason ? unavailableReasonValue(reason) : "no_data",
423
+ message: reason?.message ?? "Unavailable for this query."
424
+ };
425
+ }
426
+ function unavailableEntries(requested, data, meta) {
427
+ return requested.flatMap((name) => {
428
+ const unavailable = unavailableReason(name, meta);
429
+ if (!unavailable || name in data) return [];
430
+ return [
431
+ {
432
+ name,
433
+ displayName: METRIC_INFO[name]?.displayName || name,
434
+ type: METRIC_INFO[name]?.type || "count",
435
+ summary: null,
436
+ change: null,
437
+ unavailable
438
+ }
439
+ ];
440
+ });
441
+ }
405
442
  function summarize(points, change) {
406
443
  const values = (Array.isArray(points) ? points : []).map((point) => point.value ?? point.total).filter((value) => typeof value === "number");
407
444
  return {
@@ -634,16 +671,25 @@ async function getMetrics(input, client) {
634
671
  dateRange: { start: startDate, end: endDate },
635
672
  granularity,
636
673
  dimension: input.dimension || null,
637
- metrics: Object.keys(data).map((name) => ({
638
- name,
639
- displayName: info[name]?.displayName || name,
640
- type: info[name]?.type || "count",
641
- summary: summaries[name],
642
- change: changes[name] || null,
643
- ...input.dimension && {
644
- breakdown: summaryResponse.breakdownTotals?.[name] ?? null
645
- }
646
- })),
674
+ metrics: [
675
+ ...Object.keys(data).map((name) => ({
676
+ name,
677
+ displayName: info[name]?.displayName || name,
678
+ type: info[name]?.type || "count",
679
+ summary: summaries[name],
680
+ change: changes[name] || null,
681
+ ...input.dimension && {
682
+ breakdown: summaryResponse.breakdownTotals?.[name] ?? null
683
+ },
684
+ // A computed metric the API marks unavailable comes back as an
685
+ // empty series: it carries its reason too.
686
+ ...unavailableReason(name, meta) && {
687
+ unavailable: unavailableReason(name, meta)
688
+ }
689
+ })),
690
+ // FLO-2840: listed with the reason, never dropped or 0.
691
+ ...unavailableEntries(input.metrics, data, meta)
692
+ ],
647
693
  timeseries: data,
648
694
  meta
649
695
  })
@@ -2044,7 +2090,7 @@ function registerTools(server, client, options = {}) {
2044
2090
  tool(
2045
2091
  "send_review_reply",
2046
2092
  "Send review reply",
2047
- "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).",
2093
+ "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.",
2048
2094
  sendReviewReplySchema,
2049
2095
  sendReviewReply,
2050
2096
  { readOnlyHint: false, destructiveHint: true, openWorldHint: true }
@@ -2068,7 +2114,7 @@ function registerTools(server, client, options = {}) {
2068
2114
  tool(
2069
2115
  "get_metrics",
2070
2116
  "Get metrics",
2071
- "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.",
2117
+ "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.",
2072
2118
  getMetricsSchema,
2073
2119
  getMetrics,
2074
2120
  { readOnlyHint: true, openWorldHint: false }
@@ -2295,6 +2341,7 @@ function registerTools(server, client, options = {}) {
2295
2341
  export {
2296
2342
  FREE_CONVERSATION_ENDED_NOTICE,
2297
2343
  FREE_CONVERSATION_LABEL,
2344
+ UNAVAILABLE_REASONS,
2298
2345
  approveAction,
2299
2346
  approveActionSchema,
2300
2347
  checkActionNow,