posterly-mcp-server 0.19.3 → 0.19.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.
@@ -164,6 +164,10 @@ export interface AccountAnalyticsSummary {
164
164
  total_watch_minutes?: number | null;
165
165
  total_likes?: number | null;
166
166
  platform_metrics?: Record<string, number | null | undefined>;
167
+ display_metrics?: Array<{
168
+ label: string;
169
+ value: number | null | undefined;
170
+ }>;
167
171
  }
168
172
  export interface AccountAnalyticsSnapshot {
169
173
  date: string;
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  export const getAccountAnalyticsTool = {
3
3
  name: 'get_account_analytics',
4
- description: 'Get daily analytics snapshots and a period summary for a connected social account. Supports Instagram, Facebook, LinkedIn, Google Business Profile, Pinterest, and YouTube. For Google Business Profile, returns Profile Views, Search Views, Maps Views, Customer Actions, and Posts.',
4
+ description: 'Get daily analytics snapshots and a period summary for a connected social account. Supports Instagram, Facebook, LinkedIn, Google Business Profile, Pinterest, and YouTube. Uses API-provided display_metrics for platform-native dashboard labels such as Google Business Profile Views, Search Views, Maps Views, Customer Actions, and Posts.',
5
5
  inputSchema: z.object({
6
6
  account_id: z
7
7
  .number()
@@ -27,13 +27,11 @@ export const getAccountAnalyticsTool = {
27
27
  '',
28
28
  'Summary:',
29
29
  ];
30
- if (account.platform === 'google_business') {
31
- const metrics = summary.platform_metrics || {};
32
- pushMetric(lines, 'Profile Views', metrics.profile_views ?? summary.total_views);
33
- pushMetric(lines, 'Search Views', metrics.search_views ?? summary.total_reach);
34
- pushMetric(lines, 'Maps Views', metrics.maps_views ?? summary.total_profile_views);
35
- pushMetric(lines, 'Customer Actions', metrics.customer_actions ?? summary.total_accounts_engaged);
36
- pushMetric(lines, 'Posts', metrics.posts ?? summary.current_media_count);
30
+ const nativeRows = getNativeMetricRows(account.platform, summary);
31
+ if (nativeRows.length > 0) {
32
+ for (const [label, value] of nativeRows) {
33
+ pushMetric(lines, label, value);
34
+ }
37
35
  }
38
36
  else if (account.platform === 'pinterest') {
39
37
  pushGenericSummary(lines, summary);
@@ -50,6 +48,27 @@ export const getAccountAnalyticsTool = {
50
48
  return lines.join('\n');
51
49
  },
52
50
  };
51
+ function getNativeMetricRows(platform, summary) {
52
+ // API-provided display_metrics is the contract for platform-native dashboards.
53
+ // Add future non-generic analytics platforms there so MCP output never guesses
54
+ // from internal storage field names.
55
+ const apiRows = (summary.display_metrics || [])
56
+ .filter((metric) => metric?.label)
57
+ .map((metric) => [metric.label, metric.value]);
58
+ if (apiRows.length > 0)
59
+ return apiRows;
60
+ if (platform === 'google_business') {
61
+ const metrics = summary.platform_metrics || {};
62
+ return [
63
+ ['Profile Views', metrics.profile_views ?? summary.total_views],
64
+ ['Search Views', metrics.search_views ?? summary.total_reach],
65
+ ['Maps Views', metrics.maps_views ?? summary.total_profile_views],
66
+ ['Customer Actions', metrics.customer_actions ?? summary.total_accounts_engaged],
67
+ ['Posts', metrics.posts ?? summary.current_media_count],
68
+ ];
69
+ }
70
+ return [];
71
+ }
53
72
  function formatDelta(n) {
54
73
  return n >= 0 ? `+${n.toLocaleString()}` : n.toLocaleString();
55
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posterly-mcp-server",
3
- "version": "0.19.3",
3
+ "version": "0.19.4",
4
4
  "description": "MCP server for posterly — schedule social media posts from Claude Desktop",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.poster.ly/mcp",
@@ -152,6 +152,7 @@ export interface AccountAnalyticsSummary {
152
152
  total_watch_minutes?: number | null;
153
153
  total_likes?: number | null;
154
154
  platform_metrics?: Record<string, number | null | undefined>;
155
+ display_metrics?: Array<{ label: string; value: number | null | undefined }>;
155
156
  }
156
157
 
157
158
  export interface AccountAnalyticsSnapshot {
@@ -4,7 +4,7 @@ import type { AccountAnalyticsSummary, PosterlyClient } from '../lib/api-client.
4
4
  export const getAccountAnalyticsTool = {
5
5
  name: 'get_account_analytics',
6
6
  description:
7
- 'Get daily analytics snapshots and a period summary for a connected social account. Supports Instagram, Facebook, LinkedIn, Google Business Profile, Pinterest, and YouTube. For Google Business Profile, returns Profile Views, Search Views, Maps Views, Customer Actions, and Posts.',
7
+ 'Get daily analytics snapshots and a period summary for a connected social account. Supports Instagram, Facebook, LinkedIn, Google Business Profile, Pinterest, and YouTube. Uses API-provided display_metrics for platform-native dashboard labels such as Google Business Profile Views, Search Views, Maps Views, Customer Actions, and Posts.',
8
8
  inputSchema: z.object({
9
9
  account_id: z
10
10
  .number()
@@ -37,13 +37,11 @@ export const getAccountAnalyticsTool = {
37
37
  'Summary:',
38
38
  ];
39
39
 
40
- if (account.platform === 'google_business') {
41
- const metrics = summary.platform_metrics || {};
42
- pushMetric(lines, 'Profile Views', metrics.profile_views ?? summary.total_views);
43
- pushMetric(lines, 'Search Views', metrics.search_views ?? summary.total_reach);
44
- pushMetric(lines, 'Maps Views', metrics.maps_views ?? summary.total_profile_views);
45
- pushMetric(lines, 'Customer Actions', metrics.customer_actions ?? summary.total_accounts_engaged);
46
- pushMetric(lines, 'Posts', metrics.posts ?? summary.current_media_count);
40
+ const nativeRows = getNativeMetricRows(account.platform, summary);
41
+ if (nativeRows.length > 0) {
42
+ for (const [label, value] of nativeRows) {
43
+ pushMetric(lines, label, value);
44
+ }
47
45
  } else if (account.platform === 'pinterest') {
48
46
  pushGenericSummary(lines, summary);
49
47
  pushMetric(lines, 'Outbound clicks', summary.total_website_clicks);
@@ -59,6 +57,31 @@ export const getAccountAnalyticsTool = {
59
57
  },
60
58
  };
61
59
 
60
+ type MetricRow = [label: string, value: number | null | undefined];
61
+
62
+ function getNativeMetricRows(platform: string, summary: AccountAnalyticsSummary): MetricRow[] {
63
+ // API-provided display_metrics is the contract for platform-native dashboards.
64
+ // Add future non-generic analytics platforms there so MCP output never guesses
65
+ // from internal storage field names.
66
+ const apiRows = (summary.display_metrics || [])
67
+ .filter((metric) => metric?.label)
68
+ .map((metric) => [metric.label, metric.value] as MetricRow);
69
+ if (apiRows.length > 0) return apiRows;
70
+
71
+ if (platform === 'google_business') {
72
+ const metrics = summary.platform_metrics || {};
73
+ return [
74
+ ['Profile Views', metrics.profile_views ?? summary.total_views],
75
+ ['Search Views', metrics.search_views ?? summary.total_reach],
76
+ ['Maps Views', metrics.maps_views ?? summary.total_profile_views],
77
+ ['Customer Actions', metrics.customer_actions ?? summary.total_accounts_engaged],
78
+ ['Posts', metrics.posts ?? summary.current_media_count],
79
+ ];
80
+ }
81
+
82
+ return [];
83
+ }
84
+
62
85
  function formatDelta(n: number): string {
63
86
  return n >= 0 ? `+${n.toLocaleString()}` : n.toLocaleString();
64
87
  }