@fload-ai/mcp 0.12.2 → 0.12.3

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;AA6FX,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,42 @@ 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
+ if (reason.reason === "source_filter" || reason.cause === "filtered_out") {
413
+ return "source_filter";
414
+ }
415
+ return "no_data";
416
+ }
417
+ function unavailableReason(name, meta) {
418
+ if (!(meta.unavailableMetrics ?? []).includes(name)) return void 0;
419
+ const reason = meta.unavailableMetricReasons?.[name];
420
+ return {
421
+ reason: reason ? unavailableReasonValue(reason) : "no_data",
422
+ message: reason?.message ?? "Unavailable for this query."
423
+ };
424
+ }
425
+ function unavailableEntries(requested, data, meta) {
426
+ return requested.flatMap((name) => {
427
+ const unavailable = unavailableReason(name, meta);
428
+ if (!unavailable || name in data) return [];
429
+ return [
430
+ {
431
+ name,
432
+ displayName: METRIC_INFO[name]?.displayName || name,
433
+ type: METRIC_INFO[name]?.type || "count",
434
+ summary: null,
435
+ change: null,
436
+ unavailable
437
+ }
438
+ ];
439
+ });
440
+ }
405
441
  function summarize(points, change) {
406
442
  const values = (Array.isArray(points) ? points : []).map((point) => point.value ?? point.total).filter((value) => typeof value === "number");
407
443
  return {
@@ -634,16 +670,25 @@ async function getMetrics(input, client) {
634
670
  dateRange: { start: startDate, end: endDate },
635
671
  granularity,
636
672
  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
- })),
673
+ metrics: [
674
+ ...Object.keys(data).map((name) => ({
675
+ name,
676
+ displayName: info[name]?.displayName || name,
677
+ type: info[name]?.type || "count",
678
+ summary: summaries[name],
679
+ change: changes[name] || null,
680
+ ...input.dimension && {
681
+ breakdown: summaryResponse.breakdownTotals?.[name] ?? null
682
+ },
683
+ // A computed metric the API marks unavailable comes back as an
684
+ // empty series: it carries its reason too.
685
+ ...unavailableReason(name, meta) && {
686
+ unavailable: unavailableReason(name, meta)
687
+ }
688
+ })),
689
+ // FLO-2840: listed with the reason, never dropped or 0.
690
+ ...unavailableEntries(input.metrics, data, meta)
691
+ ],
647
692
  timeseries: data,
648
693
  meta
649
694
  })
@@ -2044,7 +2089,7 @@ function registerTools(server, client, options = {}) {
2044
2089
  tool(
2045
2090
  "send_review_reply",
2046
2091
  "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).",
2092
+ "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
2093
  sendReviewReplySchema,
2049
2094
  sendReviewReply,
2050
2095
  { readOnlyHint: false, destructiveHint: true, openWorldHint: true }
@@ -2068,7 +2113,7 @@ function registerTools(server, client, options = {}) {
2068
2113
  tool(
2069
2114
  "get_metrics",
2070
2115
  "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.",
2116
+ "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. On total reads (no dimension), a requested metric the API could not report 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 or dimension filter hides it. Never quote it as 0. Use discover_metrics first to see available metrics.",
2072
2117
  getMetricsSchema,
2073
2118
  getMetrics,
2074
2119
  { readOnlyHint: true, openWorldHint: false }
@@ -2295,6 +2340,7 @@ function registerTools(server, client, options = {}) {
2295
2340
  export {
2296
2341
  FREE_CONVERSATION_ENDED_NOTICE,
2297
2342
  FREE_CONVERSATION_LABEL,
2343
+ UNAVAILABLE_REASONS,
2298
2344
  approveAction,
2299
2345
  approveActionSchema,
2300
2346
  checkActionNow,