@trimstats/mcp 0.0.1-alpha.0 → 0.1.0

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.
@@ -0,0 +1,129 @@
1
+ export interface McpToolAnnotations {
2
+ readOnlyHint: boolean;
3
+ destructiveHint: boolean;
4
+ idempotentHint: boolean;
5
+ openWorldHint: boolean;
6
+ }
7
+ export interface McpToolDefinition {
8
+ name: TrimStatsToolName;
9
+ description: string;
10
+ inputSchema: Record<string, unknown>;
11
+ annotations: McpToolAnnotations;
12
+ }
13
+ export type TrimStatsToolName = 'list_sites' | 'get_site_overview' | 'get_live_visitors' | 'get_event_properties' | 'get_revenue_report' | 'get_anomaly_insights' | 'get_ui_friction' | 'list_funnels' | 'evaluate_funnel' | 'get_retention_cohorts' | 'get_ai_crawlers' | 'get_ai_referrals';
14
+ export interface McpFunnelStep {
15
+ label: string;
16
+ type: 'pageview' | 'event';
17
+ matchRule: string;
18
+ }
19
+ export interface OverviewToolInput {
20
+ siteId: string;
21
+ from?: string;
22
+ to?: string;
23
+ compare?: boolean;
24
+ country?: string;
25
+ device?: 'desktop' | 'mobile' | 'tablet';
26
+ browser?: string;
27
+ os?: string;
28
+ pathname?: string;
29
+ referrer?: string;
30
+ utmSource?: string;
31
+ utmMedium?: string;
32
+ utmCampaign?: string;
33
+ utmTerm?: string;
34
+ utmContent?: string;
35
+ }
36
+ export interface EventPropertiesToolInput extends Omit<OverviewToolInput, 'compare'> {
37
+ eventName: string;
38
+ }
39
+ export interface RevenueToolInput {
40
+ siteId: string;
41
+ from?: string;
42
+ to?: string;
43
+ attribution?: 'first_touch' | 'last_touch';
44
+ }
45
+ export interface InsightsToolInput {
46
+ siteId: string;
47
+ includeDetails?: boolean;
48
+ }
49
+ export interface FrictionToolInput {
50
+ siteId: string;
51
+ from?: string;
52
+ to?: string;
53
+ }
54
+ export interface EvaluateFunnelToolInput {
55
+ siteId: string;
56
+ funnelId?: string;
57
+ steps?: McpFunnelStep[];
58
+ from?: string;
59
+ to?: string;
60
+ windowSeconds?: number;
61
+ }
62
+ export interface CohortsToolInput {
63
+ siteId: string;
64
+ weeks?: number;
65
+ }
66
+ export interface AiCrawlersToolInput {
67
+ siteId: string;
68
+ from?: string;
69
+ to?: string;
70
+ category?: 'ai_answers' | 'indexing' | 'training';
71
+ crawler?: string;
72
+ pathname?: string;
73
+ }
74
+ export interface AiReferralsToolInput {
75
+ siteId: string;
76
+ from?: string;
77
+ to?: string;
78
+ provider?: string;
79
+ pathname?: string;
80
+ }
81
+ export type ValidatedToolCall = {
82
+ name: 'list_sites';
83
+ args: Record<string, never>;
84
+ } | {
85
+ name: 'get_site_overview';
86
+ args: OverviewToolInput;
87
+ } | {
88
+ name: 'get_live_visitors';
89
+ args: {
90
+ siteId: string;
91
+ };
92
+ } | {
93
+ name: 'get_event_properties';
94
+ args: EventPropertiesToolInput;
95
+ } | {
96
+ name: 'get_revenue_report';
97
+ args: RevenueToolInput;
98
+ } | {
99
+ name: 'get_anomaly_insights';
100
+ args: InsightsToolInput;
101
+ } | {
102
+ name: 'get_ui_friction';
103
+ args: FrictionToolInput;
104
+ } | {
105
+ name: 'list_funnels';
106
+ args: {
107
+ siteId: string;
108
+ };
109
+ } | {
110
+ name: 'evaluate_funnel';
111
+ args: EvaluateFunnelToolInput;
112
+ } | {
113
+ name: 'get_retention_cohorts';
114
+ args: CohortsToolInput;
115
+ } | {
116
+ name: 'get_ai_crawlers';
117
+ args: AiCrawlersToolInput;
118
+ } | {
119
+ name: 'get_ai_referrals';
120
+ args: AiReferralsToolInput;
121
+ };
122
+ export declare const TRIMSTATS_MCP_TOOLS: readonly McpToolDefinition[];
123
+ export declare function validateToolCall(name: unknown, rawArgs: unknown): {
124
+ ok: true;
125
+ call: ValidatedToolCall;
126
+ } | {
127
+ ok: false;
128
+ error: string;
129
+ };