Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

fix(mcp): coerce get_goals meta.total to a number (#1306)

Zack Zenge6b9f41d2025
diff --git a/server/src/api/analytics/goals/getGoals.ts b/server/src/api/analytics/goals/getGoals.ts
index 8db392543..b10447d31 100644
--- a/server/src/api/analytics/goals/getGoals.ts
+++ b/server/src/api/analytics/goals/getGoals.ts
@@ -132,7 +132,7 @@ export const getGoals = analyticsRoute<GetGoalsRequest>(
.from(goals)
.where(eq(goals.siteId, Number(siteId)));
- const totalGoals = totalGoalsResult[0]?.count || 0;
+ const totalGoals = Number(totalGoalsResult[0]?.count ?? 0);
const totalPages = Math.ceil(totalGoals / pageSizeNumber);
// If no goals exist, return early with empty data