@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.
package/dist/index.js CHANGED
@@ -554,6 +554,37 @@ 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
+ if (reason.reason === "source_filter" || reason.cause === "filtered_out") {
560
+ return "source_filter";
561
+ }
562
+ return "no_data";
563
+ }
564
+ function unavailableReason(name, meta) {
565
+ if (!(meta.unavailableMetrics ?? []).includes(name)) return void 0;
566
+ const reason = meta.unavailableMetricReasons?.[name];
567
+ return {
568
+ reason: reason ? unavailableReasonValue(reason) : "no_data",
569
+ message: reason?.message ?? "Unavailable for this query."
570
+ };
571
+ }
572
+ function unavailableEntries(requested, data, meta) {
573
+ return requested.flatMap((name) => {
574
+ const unavailable = unavailableReason(name, meta);
575
+ if (!unavailable || name in data) return [];
576
+ return [
577
+ {
578
+ name,
579
+ displayName: METRIC_INFO[name]?.displayName || name,
580
+ type: METRIC_INFO[name]?.type || "count",
581
+ summary: null,
582
+ change: null,
583
+ unavailable
584
+ }
585
+ ];
586
+ });
587
+ }
557
588
  function summarize(points, change) {
558
589
  const values = (Array.isArray(points) ? points : []).map((point) => point.value ?? point.total).filter((value) => typeof value === "number");
559
590
  return {
@@ -786,16 +817,25 @@ async function getMetrics(input, client) {
786
817
  dateRange: { start: startDate, end: endDate },
787
818
  granularity,
788
819
  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
- })),
820
+ metrics: [
821
+ ...Object.keys(data).map((name) => ({
822
+ name,
823
+ displayName: info[name]?.displayName || name,
824
+ type: info[name]?.type || "count",
825
+ summary: summaries[name],
826
+ change: changes[name] || null,
827
+ ...input.dimension && {
828
+ breakdown: summaryResponse.breakdownTotals?.[name] ?? null
829
+ },
830
+ // A computed metric the API marks unavailable comes back as an
831
+ // empty series: it carries its reason too.
832
+ ...unavailableReason(name, meta) && {
833
+ unavailable: unavailableReason(name, meta)
834
+ }
835
+ })),
836
+ // FLO-2840: listed with the reason, never dropped or 0.
837
+ ...unavailableEntries(input.metrics, data, meta)
838
+ ],
799
839
  timeseries: data,
800
840
  meta
801
841
  })
@@ -2171,7 +2211,7 @@ function registerTools(server, client, options = {}) {
2171
2211
  tool(
2172
2212
  "send_review_reply",
2173
2213
  "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).",
2214
+ "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
2215
  sendReviewReplySchema,
2176
2216
  sendReviewReply,
2177
2217
  { readOnlyHint: false, destructiveHint: true, openWorldHint: true }
@@ -2195,7 +2235,7 @@ function registerTools(server, client, options = {}) {
2195
2235
  tool(
2196
2236
  "get_metrics",
2197
2237
  "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.",
2238
+ "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.",
2199
2239
  getMetricsSchema,
2200
2240
  getMetrics,
2201
2241
  { readOnlyHint: true, openWorldHint: false }
@@ -2421,7 +2461,7 @@ function registerTools(server, client, options = {}) {
2421
2461
  }
2422
2462
 
2423
2463
  // src/version.ts
2424
- var FLOAD_MCP_VERSION = "0.12.2";
2464
+ var FLOAD_MCP_VERSION = "0.12.3";
2425
2465
 
2426
2466
  // src/server.ts
2427
2467
  async function createMcpServer(_config, client) {