forked from tanaikech/ToolsForMCPServer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanagement_analytics.js
More file actions
157 lines (144 loc) · 8.19 KB
/
management_analytics.js
File metadata and controls
157 lines (144 loc) · 8.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/**
* Google Analytics Admin API: https://developers.google.com/analytics/devguides/config/admin/v1/rest
* ref: https://github.com/googleanalytics/google-analytics-mcp
*/
function analytics_admin_accountSummaries_list() {
/**
* Check API
*/
const check = checkAPI_("AnalyticsAdmin");
if (check.result) {
return check;
}
return for_google_apis.list({ func: AnalyticsAdmin.AccountSummaries.list, args: [{}], jsonSchema: jsonSchemaAnalyticsAdmin.AccountSummary, itemName: "accountSummaries" });
}
function analytics_admin_properties_get(object = {}) {
/**
* Check API
*/
const check = checkAPI_("AnalyticsAdmin");
if (check.result) {
return check;
}
return for_google_apis.get({ func: AnalyticsAdmin.Properties.get, args: [object.pathParameters?.name], jsonSchema: jsonSchemaAnalyticsAdmin.Property });
}
/**
* Google Analytics Data API: https://developers.google.com/analytics/devguides/reporting/data/v1/rest
* ref: https://github.com/googleanalytics/google-analytics-mcp
*/
function analytics_data_properties_runReport(object = {}) {
/**
* Check API
*/
const check = checkAPI_("AnalyticsData");
if (check.result) {
return check;
}
return for_google_apis.create({ func: AnalyticsData.Properties.runReport, args: [object.requestBody, object.pathParameters?.property], jsonSchema: jsonSchemaAnalyticsData.RunReportResponse });
}
function analytics_data_properties_runRealtimeReport(object = {}) {
/**
* Check API
*/
const check = checkAPI_("AnalyticsData");
if (check.result) {
return check;
}
return for_google_apis.create({ func: AnalyticsData.Properties.runRealtimeReport, args: [object.requestBody, object.pathParameters?.property], jsonSchema: jsonSchemaAnalyticsData.RunRealtimeReportResponse });
}
const descriptions_management_analytics = {
analytics_admin_accountSummaries_list: {
title: "Retrieves a list of all Google Analytics accounts accessible by the current user",
description: `Use to retrieve a list of all Google Analytics accounts accessible by the current user. Each entry provides key details for the account and a summary of its properties, making it useful for discovering available data streams and managing permissions.`,
parameters: {
type: "object",
properties: {
queryParameters: {
type: "object",
properties: {}
}
}
}
},
analytics_admin_properties_get: {
title: "Get detailed information about a single Google Analytics property",
description: `Use to get detailed information about a single Google Analytics property, providing essential details for management and analysis. Use this to confirm property settings or to retrieve its metadata.`,
parameters: {
type: "object",
properties: {
pathParameters: {
type: "object",
properties: {
name: { type: "string", description: `Required. The name of the property to lookup. Format: properties/{property_id} Example: "properties/1000"` }
},
required: ["name"]
}
},
required: ["pathParameters"]
}
},
analytics_data_properties_runReport: {
title: "Fetches a custom report from a Google Analytics property",
description: [
`Use to fetch a custom report from a Google Analytics property. Specify the metrics (e.g., active users, event count) and dimensions (e.g., country, event name) to retrieve specific user activity data. This tool is best for answering questions about user behavior, such as "How many active users did we have in Japan last month?" or "What are the top 5 most popular events?"`,
// `Use to generate a customizable report from Google Analytics data. This tool allows you to query various **metrics** (like total users, sessions, or conversions) and segment them by **dimensions** (such as date, device, or page path). Use this for detailed data analysis to understand user engagement, traffic sources, and performance of specific events. The API returns the data as a table with columns for the requested metrics and dimensions.`,
// `Use to analyze Google Analytics property data to provide specific insights. This tool creates a report by defining key **metrics** (what to measure, like revenue or new users) and breaking them down by **dimensions** (how to slice the data, like by city or user's first language). It's designed to answer questions that require aggregated data, such as "Show me the number of new users from the US over the last 30 days" or "What are the most viewed pages by mobile users?"`,
`### Building request body`,
`"requestBody": Create the request body for "Method: properties.runReport" of Google Analytics Data API using the following JSON schema.`,
`<JSONSchema>${JSON.stringify(jsonSchemaAnalyticsData.RunReport)}</JSONSchema>`
].join("\n"),
parameters: {
type: "object",
properties: {
pathParameters: {
type: "object",
properties: {
property: { type: "string", description: `A Google Analytics property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see where to find your Property ID. Within a batch request, this property should either be unspecified or consistent with the batch-level property. Example: properties/1234` }
},
required: ["property"]
},
requestBody: {
type: "object",
description: [
`Create the request body for "Method: properties.runReport" of Google Analytics Data API using the provided JSON schema.`,
// `Create the request body for "Method: properties.runReport" of Google Analytics Data API by following JSON schema.`,
// `<JSONSchema>${JSON.stringify(jsonSchemaAnalyticsData.RunReport)}</JSONSchema>`,
].join("\n"),
},
},
required: ["pathParameters", "requestBody"]
}
},
analytics_data_properties_runRealtimeReport: {
title: "Generates a customized report of real-time event data from a Google Analytics property",
description: [
`Use to generate a customized report of real-time event data from a Google Analytics property, showing events and user activity that occurred within the last 30 minutes. Useful for monitoring live traffic and immediate user behavior.`,
// `Use to fetch a custom report containing real-time event and usage data for a specified Google Analytics property. This tool is ideal for analyzing user behavior as it happens, with data reflecting events sent to Google Analytics within the last 30 minutes.`,
// `Use to provides a real-time snapshot of user activity on your Google Analytics property. Use this tool to quickly check the current number of active users, popular events, and top pages, with data updated as events occur within the last 30 minutes.`,
`### Building request body`,
`"requestBody": Create the request body for "Method: properties.runRealtimeReport" of Google Analytics Data API using the following JSON schema.`,
`<JSONSchema>${JSON.stringify(jsonSchemaAnalyticsData.RunRealtimeReport)}</JSONSchema>`,
].join("\n"),
parameters: {
type: "object",
properties: {
pathParameters: {
type: "object",
properties: {
property: { type: "string", description: `A Google Analytics property identifier whose events are tracked. Specified in the URL path and not the body. To learn more, see where to find your Property ID. Example: properties/1234` }
},
required: ["property"]
},
requestBody: {
type: "object",
description: [
`Create the request body for "Method: properties.runRealtimeReport" of Google Analytics Data API using the provided JSON schema.`,
// `Create the request body for "Method: properties.runRealtimeReport" of Google Analytics Data API by following JSON schema.`,
// `<JSONSchema>${JSON.stringify(jsonSchemaAnalyticsData.RunRealtimeReport)}</JSONSchema>`,
].join("\n"),
},
},
required: ["pathParameters", "requestBody"]
}
},
};