@easyfunnel/mcp 0.1.2 → 0.1.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 +45 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -662,18 +662,14 @@ var getFunnelHealthDefinition = {
|
|
|
662
662
|
required: ["project_id"]
|
|
663
663
|
}
|
|
664
664
|
};
|
|
665
|
-
|
|
666
|
-
const data = await client2.getFunnelHealth(
|
|
667
|
-
args.project_id,
|
|
668
|
-
args.funnel_id || "",
|
|
669
|
-
args.time_range || "7d"
|
|
670
|
-
);
|
|
665
|
+
function formatFunnelHealth(data) {
|
|
671
666
|
let output = `Funnel: ${data.funnel_name}
|
|
672
667
|
Time range: ${data.time_range}
|
|
673
668
|
|
|
674
669
|
`;
|
|
675
|
-
|
|
676
|
-
|
|
670
|
+
const steps = data.steps || [];
|
|
671
|
+
for (const step of steps) {
|
|
672
|
+
const bar = "\u2588".repeat(Math.max(1, Math.round(step.count / (steps[0]?.count || 1) * 20)));
|
|
677
673
|
output += `${step.label}: ${step.count} ${bar}`;
|
|
678
674
|
if (step.drop_off_pct !== null) {
|
|
679
675
|
output += ` (\u2193 ${step.drop_off_pct}% drop-off)`;
|
|
@@ -691,8 +687,48 @@ Median time to convert: ${data.median_time_to_convert}`;
|
|
|
691
687
|
|
|
692
688
|
\u{1F4A1} ${data.suggestion}`;
|
|
693
689
|
}
|
|
690
|
+
return output;
|
|
691
|
+
}
|
|
692
|
+
async function getFunnelHealth(client2, args) {
|
|
693
|
+
const timeRange = args.time_range || "7d";
|
|
694
|
+
if (!args.funnel_id) {
|
|
695
|
+
const funnels = await client2.listFunnels(args.project_id);
|
|
696
|
+
if (!funnels || funnels.length === 0) {
|
|
697
|
+
return {
|
|
698
|
+
content: [{ type: "text", text: "No funnels found for this project. Create one with create_funnel first." }]
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
let output = `Found ${funnels.length} funnel(s). Checking health for each...
|
|
702
|
+
|
|
703
|
+
`;
|
|
704
|
+
let worstFunnel = null;
|
|
705
|
+
for (const funnel of funnels) {
|
|
706
|
+
try {
|
|
707
|
+
const data2 = await client2.getFunnelHealth(args.project_id, funnel.id, timeRange);
|
|
708
|
+
output += formatFunnelHealth(data2) + "\n---\n\n";
|
|
709
|
+
if (worstFunnel === null || data2.overall_conversion < worstFunnel.conversion) {
|
|
710
|
+
worstFunnel = { name: data2.funnel_name, conversion: data2.overall_conversion };
|
|
711
|
+
}
|
|
712
|
+
} catch {
|
|
713
|
+
output += `Funnel: ${funnel.name} (${funnel.id})
|
|
714
|
+
Error fetching health data.
|
|
715
|
+
|
|
716
|
+
---
|
|
717
|
+
|
|
718
|
+
`;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
if (worstFunnel) {
|
|
722
|
+
output += `
|
|
723
|
+
Worst-performing funnel: ${worstFunnel.name} (${worstFunnel.conversion}% conversion)`;
|
|
724
|
+
}
|
|
725
|
+
return {
|
|
726
|
+
content: [{ type: "text", text: output }]
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
const data = await client2.getFunnelHealth(args.project_id, args.funnel_id, timeRange);
|
|
694
730
|
return {
|
|
695
|
-
content: [{ type: "text", text:
|
|
731
|
+
content: [{ type: "text", text: formatFunnelHealth(data) }]
|
|
696
732
|
};
|
|
697
733
|
}
|
|
698
734
|
|