@frase/mcp-server 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.
- package/CHANGELOG.md +44 -0
- package/README.md +262 -0
- package/dist/api-client.d.ts +93 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +213 -0
- package/dist/api-client.js.map +1 -0
- package/dist/cache.d.ts +52 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +97 -0
- package/dist/cache.js.map +1 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +31 -0
- package/dist/config.js.map +1 -0
- package/dist/formatter.d.ts +47 -0
- package/dist/formatter.d.ts.map +1 -0
- package/dist/formatter.js +136 -0
- package/dist/formatter.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +292 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/competitor-analysis.d.ts +18 -0
- package/dist/prompts/competitor-analysis.d.ts.map +1 -0
- package/dist/prompts/competitor-analysis.js +71 -0
- package/dist/prompts/competitor-analysis.js.map +1 -0
- package/dist/prompts/content-audit.d.ts +18 -0
- package/dist/prompts/content-audit.d.ts.map +1 -0
- package/dist/prompts/content-audit.js +67 -0
- package/dist/prompts/content-audit.js.map +1 -0
- package/dist/prompts/create-seo-article.d.ts +19 -0
- package/dist/prompts/create-seo-article.d.ts.map +1 -0
- package/dist/prompts/create-seo-article.js +78 -0
- package/dist/prompts/create-seo-article.js.map +1 -0
- package/dist/prompts/index.d.ts +18 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +52 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/keyword-research.d.ts +18 -0
- package/dist/prompts/keyword-research.d.ts.map +1 -0
- package/dist/prompts/keyword-research.js +72 -0
- package/dist/prompts/keyword-research.js.map +1 -0
- package/dist/prompts/optimize-content.d.ts +18 -0
- package/dist/prompts/optimize-content.d.ts.map +1 -0
- package/dist/prompts/optimize-content.js +59 -0
- package/dist/prompts/optimize-content.js.map +1 -0
- package/dist/resources/briefs.d.ts +26 -0
- package/dist/resources/briefs.d.ts.map +1 -0
- package/dist/resources/briefs.js +144 -0
- package/dist/resources/briefs.js.map +1 -0
- package/dist/resources/content.d.ts +26 -0
- package/dist/resources/content.d.ts.map +1 -0
- package/dist/resources/content.js +128 -0
- package/dist/resources/content.js.map +1 -0
- package/dist/resources/index.d.ts +32 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +85 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/sites.d.ts +26 -0
- package/dist/resources/sites.d.ts.map +1 -0
- package/dist/resources/sites.js +108 -0
- package/dist/resources/sites.js.map +1 -0
- package/dist/tools/ai-visibility.d.ts +25 -0
- package/dist/tools/ai-visibility.d.ts.map +1 -0
- package/dist/tools/ai-visibility.js +537 -0
- package/dist/tools/ai-visibility.js.map +1 -0
- package/dist/tools/analytics.d.ts +17 -0
- package/dist/tools/analytics.d.ts.map +1 -0
- package/dist/tools/analytics.js +311 -0
- package/dist/tools/analytics.js.map +1 -0
- package/dist/tools/audits.d.ts +73 -0
- package/dist/tools/audits.d.ts.map +1 -0
- package/dist/tools/audits.js +345 -0
- package/dist/tools/audits.js.map +1 -0
- package/dist/tools/briefs.d.ts +63 -0
- package/dist/tools/briefs.d.ts.map +1 -0
- package/dist/tools/briefs.js +276 -0
- package/dist/tools/briefs.js.map +1 -0
- package/dist/tools/content.d.ts +51 -0
- package/dist/tools/content.d.ts.map +1 -0
- package/dist/tools/content.js +233 -0
- package/dist/tools/content.js.map +1 -0
- package/dist/tools/index.d.ts +29 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +96 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/jobs.d.ts +22 -0
- package/dist/tools/jobs.d.ts.map +1 -0
- package/dist/tools/jobs.js +124 -0
- package/dist/tools/jobs.js.map +1 -0
- package/dist/tools/optimizations.d.ts +19 -0
- package/dist/tools/optimizations.d.ts.map +1 -0
- package/dist/tools/optimizations.js +339 -0
- package/dist/tools/optimizations.js.map +1 -0
- package/dist/tools/research.d.ts +41 -0
- package/dist/tools/research.d.ts.map +1 -0
- package/dist/tools/research.js +151 -0
- package/dist/tools/research.js.map +1 -0
- package/dist/tools/serp.d.ts +15 -0
- package/dist/tools/serp.d.ts.map +1 -0
- package/dist/tools/serp.js +267 -0
- package/dist/tools/serp.js.map +1 -0
- package/dist/tools/sites.d.ts +31 -0
- package/dist/tools/sites.d.ts.map +1 -0
- package/dist/tools/sites.js +83 -0
- package/dist/tools/sites.js.map +1 -0
- package/dist/tools/webhooks.d.ts +19 -0
- package/dist/tools/webhooks.d.ts.map +1 -0
- package/dist/tools/webhooks.js +350 -0
- package/dist/tools/webhooks.js.map +1 -0
- package/dist/types.d.ts +167 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Visibility tools
|
|
3
|
+
*
|
|
4
|
+
* Track how your content appears in AI-powered search results
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { CACHE_TTL } from "../cache.js";
|
|
8
|
+
import { formatTable, formatStatus, formatDate, formatPagination, formatKeyValue, truncate, } from "../formatter.js";
|
|
9
|
+
// ============================================
|
|
10
|
+
// get_ai_visibility
|
|
11
|
+
// ============================================
|
|
12
|
+
const getAiVisibilityInputSchema = z.object({
|
|
13
|
+
site_id: z.string().optional(),
|
|
14
|
+
});
|
|
15
|
+
export const getAiVisibilityTool = {
|
|
16
|
+
name: "get_ai_visibility",
|
|
17
|
+
description: "Get an overview of your AI visibility metrics - how your content appears in AI search results like ChatGPT, Perplexity, etc.",
|
|
18
|
+
inputSchema: {
|
|
19
|
+
type: "object",
|
|
20
|
+
properties: {
|
|
21
|
+
site_id: {
|
|
22
|
+
type: "string",
|
|
23
|
+
description: "Filter by site ID (optional)",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export async function executeGetAiVisibility(input, context) {
|
|
29
|
+
const parsed = getAiVisibilityInputSchema.safeParse(input || {});
|
|
30
|
+
if (!parsed.success) {
|
|
31
|
+
return {
|
|
32
|
+
success: false,
|
|
33
|
+
markdown: `**Error:** Invalid input - ${parsed.error.message}`,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const { site_id } = parsed.data;
|
|
37
|
+
try {
|
|
38
|
+
const params = {};
|
|
39
|
+
if (site_id)
|
|
40
|
+
params.site_id = site_id;
|
|
41
|
+
const response = await context.client.get("/ai-visibility", params, CACHE_TTL.resources);
|
|
42
|
+
const data = response.data;
|
|
43
|
+
let markdown = `## AI Visibility Overview\n\n`;
|
|
44
|
+
markdown += formatKeyValue({
|
|
45
|
+
total_prompts: data.total_prompts,
|
|
46
|
+
total_citations: data.total_citations,
|
|
47
|
+
avg_position: data.avg_position !== null ? data.avg_position.toFixed(1) : "N/A",
|
|
48
|
+
recent_alerts: data.recent_alerts,
|
|
49
|
+
});
|
|
50
|
+
if (data.top_competitors.length > 0) {
|
|
51
|
+
markdown += "\n\n### Top Competitors\n\n";
|
|
52
|
+
const headers = ["Domain", "Citations"];
|
|
53
|
+
const rows = data.top_competitors.map((c) => [c.domain, c.citations.toString()]);
|
|
54
|
+
markdown += formatTable(headers, rows);
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
success: true,
|
|
58
|
+
markdown,
|
|
59
|
+
data: response,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
64
|
+
return {
|
|
65
|
+
success: false,
|
|
66
|
+
markdown: `**Error:** Failed to get AI visibility - ${message}`,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// ============================================
|
|
71
|
+
// list_prompts
|
|
72
|
+
// ============================================
|
|
73
|
+
const listPromptsInputSchema = z.object({
|
|
74
|
+
page: z.number().min(1).optional().default(1),
|
|
75
|
+
page_size: z.number().min(1).max(100).optional().default(20),
|
|
76
|
+
site_id: z.string().optional(),
|
|
77
|
+
});
|
|
78
|
+
export const listPromptsTool = {
|
|
79
|
+
name: "list_prompts",
|
|
80
|
+
description: "List AI visibility prompts you're tracking. Prompts are search queries that AI tools might use.",
|
|
81
|
+
inputSchema: {
|
|
82
|
+
type: "object",
|
|
83
|
+
properties: {
|
|
84
|
+
page: {
|
|
85
|
+
type: "number",
|
|
86
|
+
description: "Page number (default: 1)",
|
|
87
|
+
},
|
|
88
|
+
page_size: {
|
|
89
|
+
type: "number",
|
|
90
|
+
description: "Items per page, max 100 (default: 20)",
|
|
91
|
+
},
|
|
92
|
+
site_id: {
|
|
93
|
+
type: "string",
|
|
94
|
+
description: "Filter by site ID",
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
export async function executeListPrompts(input, context) {
|
|
100
|
+
const parsed = listPromptsInputSchema.safeParse(input || {});
|
|
101
|
+
if (!parsed.success) {
|
|
102
|
+
return {
|
|
103
|
+
success: false,
|
|
104
|
+
markdown: `**Error:** Invalid input - ${parsed.error.message}`,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const { page, page_size, site_id } = parsed.data;
|
|
108
|
+
try {
|
|
109
|
+
const params = { page, page_size };
|
|
110
|
+
if (site_id)
|
|
111
|
+
params.site_id = site_id;
|
|
112
|
+
const response = await context.client.get("/ai-visibility/prompts", params, CACHE_TTL.lists);
|
|
113
|
+
const headers = ["Query", "Status", "Citations", "Avg Pos", "Last Crawled"];
|
|
114
|
+
const rows = response.data.map((prompt) => [
|
|
115
|
+
truncate(prompt.query, 40),
|
|
116
|
+
formatStatus(prompt.status),
|
|
117
|
+
prompt.citations_count.toString(),
|
|
118
|
+
prompt.avg_position !== null ? prompt.avg_position.toFixed(1) : "-",
|
|
119
|
+
prompt.last_crawled_at ? formatDate(prompt.last_crawled_at) : "Never",
|
|
120
|
+
]);
|
|
121
|
+
const table = formatTable(headers, rows);
|
|
122
|
+
const pagination = formatPagination(response.pagination);
|
|
123
|
+
return {
|
|
124
|
+
success: true,
|
|
125
|
+
markdown: `## AI Visibility Prompts (Page ${page})\n\n${table}${pagination}`,
|
|
126
|
+
data: response,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
131
|
+
return {
|
|
132
|
+
success: false,
|
|
133
|
+
markdown: `**Error:** Failed to list prompts - ${message}`,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// ============================================
|
|
138
|
+
// create_prompt
|
|
139
|
+
// ============================================
|
|
140
|
+
const createPromptInputSchema = z.object({
|
|
141
|
+
query: z.string().min(1).max(500),
|
|
142
|
+
site_id: z.string().optional(),
|
|
143
|
+
});
|
|
144
|
+
export const createPromptTool = {
|
|
145
|
+
name: "create_prompt",
|
|
146
|
+
description: "Create a new AI visibility prompt to track. This will monitor how AI search results respond to this query.",
|
|
147
|
+
inputSchema: {
|
|
148
|
+
type: "object",
|
|
149
|
+
properties: {
|
|
150
|
+
query: {
|
|
151
|
+
type: "string",
|
|
152
|
+
description: "The search query to track (required)",
|
|
153
|
+
},
|
|
154
|
+
site_id: {
|
|
155
|
+
type: "string",
|
|
156
|
+
description: "Associate with a specific site",
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
required: ["query"],
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
export async function executeCreatePrompt(input, context) {
|
|
163
|
+
const parsed = createPromptInputSchema.safeParse(input);
|
|
164
|
+
if (!parsed.success) {
|
|
165
|
+
return {
|
|
166
|
+
success: false,
|
|
167
|
+
markdown: `**Error:** Invalid input - ${parsed.error.message}`,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
const { query, site_id } = parsed.data;
|
|
171
|
+
try {
|
|
172
|
+
const response = await context.client.post("/ai-visibility/prompts", { query, site_id });
|
|
173
|
+
const prompt = response.data;
|
|
174
|
+
const details = formatKeyValue({
|
|
175
|
+
id: prompt.id,
|
|
176
|
+
query: prompt.query,
|
|
177
|
+
status: prompt.status,
|
|
178
|
+
});
|
|
179
|
+
return {
|
|
180
|
+
success: true,
|
|
181
|
+
markdown: `## Prompt Created\n\n${details}\n\n**Note:** The prompt will be crawled automatically. Use \`get_prompt\` to see results.`,
|
|
182
|
+
data: response,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
187
|
+
return {
|
|
188
|
+
success: false,
|
|
189
|
+
markdown: `**Error:** Failed to create prompt - ${message}`,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
// ============================================
|
|
194
|
+
// get_prompt
|
|
195
|
+
// ============================================
|
|
196
|
+
const getPromptInputSchema = z.object({
|
|
197
|
+
id: z.string().min(1),
|
|
198
|
+
});
|
|
199
|
+
export const getPromptTool = {
|
|
200
|
+
name: "get_prompt",
|
|
201
|
+
description: "Get details of a specific AI visibility prompt, including the latest search results.",
|
|
202
|
+
inputSchema: {
|
|
203
|
+
type: "object",
|
|
204
|
+
properties: {
|
|
205
|
+
id: {
|
|
206
|
+
type: "string",
|
|
207
|
+
description: "The prompt ID (required)",
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
required: ["id"],
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
export async function executeGetPrompt(input, context) {
|
|
214
|
+
const parsed = getPromptInputSchema.safeParse(input);
|
|
215
|
+
if (!parsed.success) {
|
|
216
|
+
return {
|
|
217
|
+
success: false,
|
|
218
|
+
markdown: `**Error:** Invalid input - ${parsed.error.message}`,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
const { id } = parsed.data;
|
|
222
|
+
try {
|
|
223
|
+
const response = await context.client.get(`/ai-visibility/prompts/${id}`, {}, CACHE_TTL.resources);
|
|
224
|
+
const prompt = response.data;
|
|
225
|
+
let markdown = `## Prompt: ${prompt.query}\n\n`;
|
|
226
|
+
markdown += formatKeyValue({
|
|
227
|
+
id: prompt.id,
|
|
228
|
+
status: prompt.status,
|
|
229
|
+
citations: prompt.citations_count,
|
|
230
|
+
avg_position: prompt.avg_position !== null ? prompt.avg_position.toFixed(1) : "N/A",
|
|
231
|
+
last_crawled: prompt.last_crawled_at ? formatDate(prompt.last_crawled_at) : "Never",
|
|
232
|
+
});
|
|
233
|
+
if (prompt.results && prompt.results.length > 0) {
|
|
234
|
+
markdown += "\n\n### Search Results\n\n";
|
|
235
|
+
const headers = ["Pos", "URL", "Title", "Your Site?"];
|
|
236
|
+
const rows = prompt.results.map((r) => [
|
|
237
|
+
r.position.toString(),
|
|
238
|
+
truncate(r.url, 40),
|
|
239
|
+
truncate(r.title || "-", 30),
|
|
240
|
+
r.is_own_site ? "Yes" : "No",
|
|
241
|
+
]);
|
|
242
|
+
markdown += formatTable(headers, rows);
|
|
243
|
+
}
|
|
244
|
+
return {
|
|
245
|
+
success: true,
|
|
246
|
+
markdown,
|
|
247
|
+
data: response,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
catch (error) {
|
|
251
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
252
|
+
return {
|
|
253
|
+
success: false,
|
|
254
|
+
markdown: `**Error:** Failed to get prompt - ${message}`,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// ============================================
|
|
259
|
+
// update_prompt
|
|
260
|
+
// ============================================
|
|
261
|
+
const updatePromptInputSchema = z.object({
|
|
262
|
+
id: z.string().min(1),
|
|
263
|
+
query: z.string().min(1).max(500).optional(),
|
|
264
|
+
site_id: z.string().optional(),
|
|
265
|
+
});
|
|
266
|
+
export const updatePromptTool = {
|
|
267
|
+
name: "update_prompt",
|
|
268
|
+
description: "Update an AI visibility prompt.",
|
|
269
|
+
inputSchema: {
|
|
270
|
+
type: "object",
|
|
271
|
+
properties: {
|
|
272
|
+
id: {
|
|
273
|
+
type: "string",
|
|
274
|
+
description: "The prompt ID (required)",
|
|
275
|
+
},
|
|
276
|
+
query: {
|
|
277
|
+
type: "string",
|
|
278
|
+
description: "New query text",
|
|
279
|
+
},
|
|
280
|
+
site_id: {
|
|
281
|
+
type: "string",
|
|
282
|
+
description: "New site association",
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
required: ["id"],
|
|
286
|
+
},
|
|
287
|
+
};
|
|
288
|
+
export async function executeUpdatePrompt(input, context) {
|
|
289
|
+
const parsed = updatePromptInputSchema.safeParse(input);
|
|
290
|
+
if (!parsed.success) {
|
|
291
|
+
return {
|
|
292
|
+
success: false,
|
|
293
|
+
markdown: `**Error:** Invalid input - ${parsed.error.message}`,
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
const { id, ...updates } = parsed.data;
|
|
297
|
+
try {
|
|
298
|
+
const response = await context.client.patch(`/ai-visibility/prompts/${id}`, updates);
|
|
299
|
+
const prompt = response.data;
|
|
300
|
+
const details = formatKeyValue({
|
|
301
|
+
id: prompt.id,
|
|
302
|
+
query: prompt.query,
|
|
303
|
+
status: prompt.status,
|
|
304
|
+
});
|
|
305
|
+
return {
|
|
306
|
+
success: true,
|
|
307
|
+
markdown: `## Prompt Updated\n\n${details}`,
|
|
308
|
+
data: response,
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
catch (error) {
|
|
312
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
313
|
+
return {
|
|
314
|
+
success: false,
|
|
315
|
+
markdown: `**Error:** Failed to update prompt - ${message}`,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
// ============================================
|
|
320
|
+
// get_competitors
|
|
321
|
+
// ============================================
|
|
322
|
+
const getCompetitorsInputSchema = z.object({
|
|
323
|
+
site_id: z.string().optional(),
|
|
324
|
+
limit: z.number().min(1).max(50).optional().default(20),
|
|
325
|
+
});
|
|
326
|
+
export const getCompetitorsTool = {
|
|
327
|
+
name: "get_competitors",
|
|
328
|
+
description: "Get AI visibility competitors - domains that appear alongside your content in AI search results.",
|
|
329
|
+
inputSchema: {
|
|
330
|
+
type: "object",
|
|
331
|
+
properties: {
|
|
332
|
+
site_id: {
|
|
333
|
+
type: "string",
|
|
334
|
+
description: "Filter by site ID",
|
|
335
|
+
},
|
|
336
|
+
limit: {
|
|
337
|
+
type: "number",
|
|
338
|
+
description: "Max competitors to return (default: 20)",
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
};
|
|
343
|
+
export async function executeGetCompetitors(input, context) {
|
|
344
|
+
const parsed = getCompetitorsInputSchema.safeParse(input || {});
|
|
345
|
+
if (!parsed.success) {
|
|
346
|
+
return {
|
|
347
|
+
success: false,
|
|
348
|
+
markdown: `**Error:** Invalid input - ${parsed.error.message}`,
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
const { site_id, limit } = parsed.data;
|
|
352
|
+
try {
|
|
353
|
+
const params = { limit };
|
|
354
|
+
if (site_id)
|
|
355
|
+
params.site_id = site_id;
|
|
356
|
+
const response = await context.client.get("/ai-visibility/competitors", params, CACHE_TTL.resources);
|
|
357
|
+
const competitors = response.data;
|
|
358
|
+
if (competitors.length === 0) {
|
|
359
|
+
return {
|
|
360
|
+
success: true,
|
|
361
|
+
markdown: "## AI Visibility Competitors\n\n_No competitors found yet. Add prompts to track._",
|
|
362
|
+
data: response,
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
const headers = ["Domain", "Citations", "Avg Pos", "Prompts", "Overlap"];
|
|
366
|
+
const rows = competitors.map((c) => [
|
|
367
|
+
c.domain,
|
|
368
|
+
c.total_citations.toString(),
|
|
369
|
+
c.avg_position !== null ? c.avg_position.toFixed(1) : "-",
|
|
370
|
+
c.prompts_cited.toString(),
|
|
371
|
+
`${c.overlap_percentage}%`,
|
|
372
|
+
]);
|
|
373
|
+
const table = formatTable(headers, rows);
|
|
374
|
+
return {
|
|
375
|
+
success: true,
|
|
376
|
+
markdown: `## AI Visibility Competitors\n\n${table}`,
|
|
377
|
+
data: response,
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
catch (error) {
|
|
381
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
382
|
+
return {
|
|
383
|
+
success: false,
|
|
384
|
+
markdown: `**Error:** Failed to get competitors - ${message}`,
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
// ============================================
|
|
389
|
+
// get_alerts
|
|
390
|
+
// ============================================
|
|
391
|
+
const getAlertsInputSchema = z.object({
|
|
392
|
+
unread_only: z.boolean().optional().default(false),
|
|
393
|
+
limit: z.number().min(1).max(100).optional().default(20),
|
|
394
|
+
});
|
|
395
|
+
export const getAlertsTool = {
|
|
396
|
+
name: "get_alerts",
|
|
397
|
+
description: "Get AI visibility alerts - notifications about changes in your AI search presence.",
|
|
398
|
+
inputSchema: {
|
|
399
|
+
type: "object",
|
|
400
|
+
properties: {
|
|
401
|
+
unread_only: {
|
|
402
|
+
type: "boolean",
|
|
403
|
+
description: "Only return unread alerts (default: false)",
|
|
404
|
+
},
|
|
405
|
+
limit: {
|
|
406
|
+
type: "number",
|
|
407
|
+
description: "Max alerts to return (default: 20)",
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
},
|
|
411
|
+
};
|
|
412
|
+
export async function executeGetAlerts(input, context) {
|
|
413
|
+
const parsed = getAlertsInputSchema.safeParse(input || {});
|
|
414
|
+
if (!parsed.success) {
|
|
415
|
+
return {
|
|
416
|
+
success: false,
|
|
417
|
+
markdown: `**Error:** Invalid input - ${parsed.error.message}`,
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
const { unread_only, limit } = parsed.data;
|
|
421
|
+
try {
|
|
422
|
+
const params = { limit };
|
|
423
|
+
if (unread_only)
|
|
424
|
+
params.unread_only = true;
|
|
425
|
+
const response = await context.client.get("/ai-visibility/alerts", params, CACHE_TTL.lists);
|
|
426
|
+
const alerts = response.data;
|
|
427
|
+
if (alerts.length === 0) {
|
|
428
|
+
return {
|
|
429
|
+
success: true,
|
|
430
|
+
markdown: "## AI Visibility Alerts\n\n_No alerts found._",
|
|
431
|
+
data: response,
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
const headers = ["Severity", "Type", "Message", "Date"];
|
|
435
|
+
const rows = alerts.map((a) => [
|
|
436
|
+
formatStatus(a.severity),
|
|
437
|
+
a.type,
|
|
438
|
+
truncate(a.message, 50),
|
|
439
|
+
formatDate(a.created_at),
|
|
440
|
+
]);
|
|
441
|
+
const table = formatTable(headers, rows);
|
|
442
|
+
return {
|
|
443
|
+
success: true,
|
|
444
|
+
markdown: `## AI Visibility Alerts\n\n${table}`,
|
|
445
|
+
data: response,
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
catch (error) {
|
|
449
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
450
|
+
return {
|
|
451
|
+
success: false,
|
|
452
|
+
markdown: `**Error:** Failed to get alerts - ${message}`,
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
// ============================================
|
|
457
|
+
// get_insights
|
|
458
|
+
// ============================================
|
|
459
|
+
const getInsightsInputSchema = z.object({
|
|
460
|
+
limit: z.number().min(1).max(50).optional().default(10),
|
|
461
|
+
});
|
|
462
|
+
export const getInsightsTool = {
|
|
463
|
+
name: "get_insights",
|
|
464
|
+
description: "Get AI visibility insights - actionable recommendations based on your AI search data.",
|
|
465
|
+
inputSchema: {
|
|
466
|
+
type: "object",
|
|
467
|
+
properties: {
|
|
468
|
+
limit: {
|
|
469
|
+
type: "number",
|
|
470
|
+
description: "Max insights to return (default: 10)",
|
|
471
|
+
},
|
|
472
|
+
},
|
|
473
|
+
},
|
|
474
|
+
};
|
|
475
|
+
export async function executeGetInsights(input, context) {
|
|
476
|
+
const parsed = getInsightsInputSchema.safeParse(input || {});
|
|
477
|
+
if (!parsed.success) {
|
|
478
|
+
return {
|
|
479
|
+
success: false,
|
|
480
|
+
markdown: `**Error:** Invalid input - ${parsed.error.message}`,
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
const { limit } = parsed.data;
|
|
484
|
+
try {
|
|
485
|
+
const response = await context.client.get("/ai-visibility/insights", { limit }, CACHE_TTL.resources);
|
|
486
|
+
const insights = response.data;
|
|
487
|
+
if (insights.length === 0) {
|
|
488
|
+
return {
|
|
489
|
+
success: true,
|
|
490
|
+
markdown: "## AI Visibility Insights\n\n_No insights available yet. Add more prompts to generate insights._",
|
|
491
|
+
data: response,
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
let markdown = "## AI Visibility Insights\n\n";
|
|
495
|
+
for (const insight of insights) {
|
|
496
|
+
markdown += `### ${insight.title}\n\n`;
|
|
497
|
+
markdown += `**Priority:** ${insight.priority} | **Type:** ${insight.type}\n\n`;
|
|
498
|
+
markdown += `${insight.description}\n\n`;
|
|
499
|
+
}
|
|
500
|
+
return {
|
|
501
|
+
success: true,
|
|
502
|
+
markdown,
|
|
503
|
+
data: response,
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
catch (error) {
|
|
507
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
508
|
+
return {
|
|
509
|
+
success: false,
|
|
510
|
+
markdown: `**Error:** Failed to get insights - ${message}`,
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
// ============================================
|
|
515
|
+
// Export all
|
|
516
|
+
// ============================================
|
|
517
|
+
export const aiVisibilityTools = [
|
|
518
|
+
getAiVisibilityTool,
|
|
519
|
+
listPromptsTool,
|
|
520
|
+
createPromptTool,
|
|
521
|
+
getPromptTool,
|
|
522
|
+
updatePromptTool,
|
|
523
|
+
getCompetitorsTool,
|
|
524
|
+
getAlertsTool,
|
|
525
|
+
getInsightsTool,
|
|
526
|
+
];
|
|
527
|
+
export const aiVisibilityExecutors = {
|
|
528
|
+
get_ai_visibility: executeGetAiVisibility,
|
|
529
|
+
list_prompts: executeListPrompts,
|
|
530
|
+
create_prompt: executeCreatePrompt,
|
|
531
|
+
get_prompt: executeGetPrompt,
|
|
532
|
+
update_prompt: executeUpdatePrompt,
|
|
533
|
+
get_competitors: executeGetCompetitors,
|
|
534
|
+
get_alerts: executeGetAlerts,
|
|
535
|
+
get_insights: executeGetInsights,
|
|
536
|
+
};
|
|
537
|
+
//# sourceMappingURL=ai-visibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-visibility.js","sourceRoot":"","sources":["../../src/tools/ai-visibility.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,QAAQ,GACT,MAAM,iBAAiB,CAAC;AAoEzB,+CAA+C;AAC/C,oBAAoB;AACpB,+CAA+C;AAE/C,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,IAAI,EAAE,mBAAmB;IACzB,WAAW,EACT,8HAA8H;IAChI,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,8BAA8B;aAC5C;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,KAAc,EACd,OAAoB;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B,GAG9B;IACF,iBAAiB,EAAE,sBAAsB;IACzC,YAAY,EAAE,kBAAkB;IAChC,aAAa,EAAE,mBAAmB;IAClC,UAAU,EAAE,gBAAgB;IAC5B,aAAa,EAAE,mBAAmB;IAClC,eAAe,EAAE,qBAAqB;IACtC,UAAU,EAAE,gBAAgB;IAC5B,YAAY,EAAE,kBAAkB;CACjC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics tools
|
|
3
|
+
*
|
|
4
|
+
* Google Search Console and content analytics
|
|
5
|
+
*/
|
|
6
|
+
import type { McpToolDefinition, ToolContext, ToolResult } from "../types.js";
|
|
7
|
+
export declare const getGscOverviewTool: McpToolDefinition;
|
|
8
|
+
export declare function executeGetGscOverview(input: unknown, context: ToolContext): Promise<ToolResult>;
|
|
9
|
+
export declare const getGscQueriesTool: McpToolDefinition;
|
|
10
|
+
export declare function executeGetGscQueries(input: unknown, context: ToolContext): Promise<ToolResult>;
|
|
11
|
+
export declare const getGscPagesTool: McpToolDefinition;
|
|
12
|
+
export declare function executeGetGscPages(input: unknown, context: ToolContext): Promise<ToolResult>;
|
|
13
|
+
export declare const getContentGapsTool: McpToolDefinition;
|
|
14
|
+
export declare function executeGetContentGaps(input: unknown, context: ToolContext): Promise<ToolResult>;
|
|
15
|
+
export declare const analyticsTools: McpToolDefinition[];
|
|
16
|
+
export declare const analyticsExecutors: Record<string, (input: unknown, context: ToolContext) => Promise<ToolResult>>;
|
|
17
|
+
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/tools/analytics.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACV,iBAAiB,EACjB,WAAW,EACX,UAAU,EAEX,MAAM,aAAa,CAAC;AA+DrB,eAAO,MAAM,kBAAkB,EAAE,iBAiBhC,CAAC;AAEF,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CAgDrB;AAaD,eAAO,MAAM,iBAAiB,EAAE,iBA0B/B,CAAC;AAEF,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CAmDrB;AAaD,eAAO,MAAM,eAAe,EAAE,iBA0B7B,CAAC;AAEF,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CAmDrB;AAWD,eAAO,MAAM,kBAAkB,EAAE,iBAiBhC,CAAC;AAEF,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CAmDrB;AAMD,eAAO,MAAM,cAAc,EAAE,iBAAiB,EAK7C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,MAAM,CACrC,MAAM,EACN,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,UAAU,CAAC,CAM9D,CAAC"}
|