@recapt/mcp 0.0.19-beta → 0.0.20

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.
Files changed (93) hide show
  1. package/dist/cli/index.d.ts +0 -11
  2. package/dist/cli/index.js +1059 -21
  3. package/dist/index.d.ts +0 -19
  4. package/dist/index.js +3210 -89
  5. package/package.json +5 -3
  6. package/dist/api/client.d.ts +0 -6
  7. package/dist/api/client.js +0 -6
  8. package/dist/cli/commands/setup-self-improvement-gh.d.ts +0 -7
  9. package/dist/cli/commands/setup-self-improvement-gh.js +0 -310
  10. package/dist/cli/commands/setup.d.ts +0 -7
  11. package/dist/cli/commands/setup.js +0 -178
  12. package/dist/cli/commands/skill.d.ts +0 -24
  13. package/dist/cli/commands/skill.js +0 -264
  14. package/dist/cli/utils/ide-config.d.ts +0 -31
  15. package/dist/cli/utils/ide-config.js +0 -294
  16. package/dist/cli/utils/prompts.d.ts +0 -22
  17. package/dist/cli/utils/prompts.js +0 -71
  18. package/dist/tools/analyzeFlow.d.ts +0 -7
  19. package/dist/tools/analyzeFlow.js +0 -68
  20. package/dist/tools/analyzeFunnel.d.ts +0 -7
  21. package/dist/tools/analyzeFunnel.js +0 -63
  22. package/dist/tools/catalog/callTool.d.ts +0 -22
  23. package/dist/tools/catalog/callTool.js +0 -92
  24. package/dist/tools/catalog/index.d.ts +0 -11
  25. package/dist/tools/catalog/index.js +0 -11
  26. package/dist/tools/catalog/searchTools.d.ts +0 -22
  27. package/dist/tools/catalog/searchTools.js +0 -194
  28. package/dist/tools/compareCohorts.d.ts +0 -6
  29. package/dist/tools/compareCohorts.js +0 -84
  30. package/dist/tools/comparePeriods.d.ts +0 -6
  31. package/dist/tools/comparePeriods.js +0 -54
  32. package/dist/tools/detectDrift.d.ts +0 -6
  33. package/dist/tools/detectDrift.js +0 -55
  34. package/dist/tools/detectRegressions.d.ts +0 -6
  35. package/dist/tools/detectRegressions.js +0 -63
  36. package/dist/tools/diagnostic.d.ts +0 -6
  37. package/dist/tools/diagnostic.js +0 -109
  38. package/dist/tools/discoverPersonas.d.ts +0 -6
  39. package/dist/tools/discoverPersonas.js +0 -50
  40. package/dist/tools/getActionableIssues.d.ts +0 -7
  41. package/dist/tools/getActionableIssues.js +0 -55
  42. package/dist/tools/getAnomalies.d.ts +0 -6
  43. package/dist/tools/getAnomalies.js +0 -53
  44. package/dist/tools/getConsoleErrors.d.ts +0 -6
  45. package/dist/tools/getConsoleErrors.js +0 -61
  46. package/dist/tools/getDeadClicks.d.ts +0 -6
  47. package/dist/tools/getDeadClicks.js +0 -42
  48. package/dist/tools/getDomains.d.ts +0 -6
  49. package/dist/tools/getDomains.js +0 -34
  50. package/dist/tools/getElementFriction.d.ts +0 -6
  51. package/dist/tools/getElementFriction.js +0 -45
  52. package/dist/tools/getFlowFriction.d.ts +0 -7
  53. package/dist/tools/getFlowFriction.js +0 -57
  54. package/dist/tools/getFormFriction.d.ts +0 -6
  55. package/dist/tools/getFormFriction.js +0 -42
  56. package/dist/tools/getIssues.d.ts +0 -6
  57. package/dist/tools/getIssues.js +0 -82
  58. package/dist/tools/getJourneyPatterns.d.ts +0 -7
  59. package/dist/tools/getJourneyPatterns.js +0 -50
  60. package/dist/tools/getPageMetrics.d.ts +0 -6
  61. package/dist/tools/getPageMetrics.js +0 -47
  62. package/dist/tools/getPageTrends.d.ts +0 -6
  63. package/dist/tools/getPageTrends.js +0 -46
  64. package/dist/tools/getSessionDetails.d.ts +0 -6
  65. package/dist/tools/getSessionDetails.js +0 -70
  66. package/dist/tools/getSessionPages.d.ts +0 -7
  67. package/dist/tools/getSessionPages.js +0 -74
  68. package/dist/tools/getUxHealthReport.d.ts +0 -7
  69. package/dist/tools/getUxHealthReport.js +0 -50
  70. package/dist/tools/improvementRun.d.ts +0 -6
  71. package/dist/tools/improvementRun.js +0 -386
  72. package/dist/tools/knowledge.d.ts +0 -6
  73. package/dist/tools/knowledge.js +0 -186
  74. package/dist/tools/listPages.d.ts +0 -6
  75. package/dist/tools/listPages.js +0 -50
  76. package/dist/tools/listSessions.d.ts +0 -7
  77. package/dist/tools/listSessions.js +0 -67
  78. package/dist/tools/memory.d.ts +0 -7
  79. package/dist/tools/memory.js +0 -119
  80. package/dist/tools/predictOutcomes.d.ts +0 -6
  81. package/dist/tools/predictOutcomes.js +0 -66
  82. package/dist/tools/remediation.d.ts +0 -6
  83. package/dist/tools/remediation.js +0 -335
  84. package/dist/tools/scanSite.d.ts +0 -6
  85. package/dist/tools/scanSite.js +0 -51
  86. package/dist/tools/searchSessions.d.ts +0 -6
  87. package/dist/tools/searchSessions.js +0 -51
  88. package/dist/tools/triage.d.ts +0 -6
  89. package/dist/tools/triage.js +0 -114
  90. package/dist/tools/triageSessions.d.ts +0 -8
  91. package/dist/tools/triageSessions.js +0 -197
  92. package/dist/tools/upgradeOptions.d.ts +0 -7
  93. package/dist/tools/upgradeOptions.js +0 -67
@@ -1,386 +0,0 @@
1
- /**
2
- * Improvement Run tools for tracking self-improvement workflow executions.
3
- *
4
- * Provides run registration, phase updates, action recording, and run listing.
5
- */
6
- import { z } from "zod";
7
- import { apiGet, apiPost, apiPatch, isApiConfigured } from "../api/client.js";
8
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
- export function registerImprovementRunTools(server) {
10
- server.registerTool("start_improvement_run", {
11
- description: "Register the start of a self-improvement workflow run. Call this at the beginning of an improvement session to track the run and its outcomes. Returns a run ID to use for subsequent updates.",
12
- inputSchema: z.object({
13
- trigger_type: z
14
- .enum(["github_actions", "cron", "manual", "api"])
15
- .describe("What triggered this improvement run"),
16
- trigger_metadata: z
17
- .record(z.unknown())
18
- .optional()
19
- .describe("Additional metadata about the trigger (e.g., GitHub run ID, branch, actor)"),
20
- phases: z
21
- .array(z.object({
22
- name: z.string(),
23
- status: z
24
- .enum(["pending", "running", "completed", "skipped", "failed"])
25
- .default("pending"),
26
- }))
27
- .optional()
28
- .describe("Initial phases to track (e.g., diagnose, investigate, fix)"),
29
- }),
30
- }, async ({ trigger_type, trigger_metadata, phases, }) => {
31
- if (!isApiConfigured()) {
32
- return {
33
- content: [
34
- {
35
- type: "text",
36
- text: JSON.stringify({ error: "API not configured" }),
37
- },
38
- ],
39
- isError: true,
40
- };
41
- }
42
- const { data, error } = await apiPost("/improvement-runs", {
43
- trigger_type,
44
- trigger_metadata,
45
- phases,
46
- });
47
- if (error) {
48
- return {
49
- content: [{ type: "text", text: JSON.stringify({ error }) }],
50
- isError: true,
51
- };
52
- }
53
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
54
- });
55
- server.registerTool("update_improvement_run", {
56
- description: "Update an improvement run's status, phases, or summary. Use to track progress through the workflow phases and record final outcomes.",
57
- inputSchema: z.object({
58
- run_id: z.string().describe("The ID of the improvement run to update"),
59
- status: z
60
- .enum(["running", "completed", "failed", "cancelled"])
61
- .optional()
62
- .describe("New status for the run"),
63
- title: z
64
- .string()
65
- .optional()
66
- .describe("A concise title summarizing what was fixed in this run (e.g., 'Fixed checkout button, improved mobile nav'). Set when completing the run."),
67
- phases: z
68
- .array(z.object({
69
- name: z.string(),
70
- status: z.enum([
71
- "pending",
72
- "running",
73
- "completed",
74
- "skipped",
75
- "failed",
76
- ]),
77
- startedAt: z.string().nullable().optional(),
78
- completedAt: z.string().nullable().optional(),
79
- output: z.record(z.unknown()).optional(),
80
- }))
81
- .optional()
82
- .describe("Updated phases array"),
83
- summary: z
84
- .object({
85
- issuesFound: z.number().optional(),
86
- issuesFixed: z.number().optional(),
87
- issuesDeferred: z.number().optional(),
88
- issuesDismissed: z.number().optional(),
89
- prsCreated: z.number().optional(),
90
- })
91
- .optional()
92
- .describe("Updated summary counts"),
93
- completed_at: z
94
- .string()
95
- .optional()
96
- .describe("ISO timestamp when the run completed"),
97
- duration_ms: z
98
- .number()
99
- .optional()
100
- .describe("Total duration of the run in milliseconds"),
101
- }),
102
- }, async ({ run_id, status, title, phases, summary, completed_at, duration_ms, }) => {
103
- if (!isApiConfigured()) {
104
- return {
105
- content: [
106
- {
107
- type: "text",
108
- text: JSON.stringify({ error: "API not configured" }),
109
- },
110
- ],
111
- isError: true,
112
- };
113
- }
114
- const { data, error } = await apiPatch(`/improvement-runs/${run_id}`, {
115
- status,
116
- title,
117
- phases,
118
- summary,
119
- completed_at,
120
- duration_ms,
121
- });
122
- if (error) {
123
- return {
124
- content: [{ type: "text", text: JSON.stringify({ error }) }],
125
- isError: true,
126
- };
127
- }
128
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
129
- });
130
- server.registerTool("record_improvement_action", {
131
- description: "Record an action taken during an improvement run. Use to track what was done for each issue: code fixes, deferrals, dismissals, etc. " +
132
- "IMPORTANT: When recording code_fix actions, the code_changes.diff field must contain ACTUAL SOURCE CODE in unified diff format, " +
133
- "not a description of what changed. Include the literal code lines with proper +/- prefixes.",
134
- inputSchema: z.object({
135
- run_id: z.string().describe("The ID of the improvement run"),
136
- issue_id: z
137
- .string()
138
- .optional()
139
- .describe("The ID of the issue this action relates to (if any)"),
140
- action_type: z
141
- .enum([
142
- "code_fix",
143
- "needs_more_data",
144
- "dismissed",
145
- "marked_intended",
146
- "knowledge_added",
147
- ])
148
- .describe("Type of action taken"),
149
- hypothesis: z.string().describe("AI's reasoning for this action"),
150
- expected_improvement: z
151
- .string()
152
- .describe("What improvement is expected from this action"),
153
- code_changes: z
154
- .array(z.object({
155
- file: z.string().describe("Path to the changed file"),
156
- diff: z
157
- .string()
158
- .describe("CRITICAL: Must be actual source code in unified diff format, NOT a description of changes. " +
159
- "This field must contain the literal code lines that were changed.\n\n" +
160
- "FORMAT REQUIREMENTS:\n" +
161
- "1. Start with @@ header: @@ -oldStart,oldCount +newStart,newCount @@\n" +
162
- "2. Context lines (unchanged): prefix with single space ' '\n" +
163
- "3. Removed lines: prefix with minus '-'\n" +
164
- "4. Added lines: prefix with plus '+'\n" +
165
- "5. Include 5 lines of context before and after the change\n\n" +
166
- "CORRECT EXAMPLE:\n" +
167
- "@@ -35,7 +35,9 @@\n" +
168
- " import { Spinner } from '@chakra-ui/react';\n" +
169
- " \n" +
170
- " export function FilterDropdown({ filters }) {\n" +
171
- "- const [isOpen, setIsOpen] = useState(false);\n" +
172
- "+ const [isOpen, setIsOpen] = useState(false);\n" +
173
- "+ const [isLoading, setIsLoading] = useState(false);\n" +
174
- " const handleClick = () => {\n" +
175
- " \n\n" +
176
- "WRONG (do NOT do this):\n" +
177
- "- 'Added isLoading state to provide feedback'\n" +
178
- "- 'Changed the button to show a spinner'\n" +
179
- "- Any prose description instead of actual code"),
180
- startLine: z
181
- .number()
182
- .describe("Line number in the original file where the first line of the diff begins (the first context line)"),
183
- linesAdded: z
184
- .number()
185
- .default(0)
186
- .describe("Count of lines added (lines starting with '+')"),
187
- linesRemoved: z
188
- .number()
189
- .default(0)
190
- .describe("Count of lines removed (lines starting with '-')"),
191
- }))
192
- .optional()
193
- .describe("Array of code changes. Each diff MUST contain actual source code lines, not descriptions."),
194
- pr_url: z
195
- .string()
196
- .optional()
197
- .describe("GitHub PR URL if a PR was created"),
198
- pr_number: z.number().optional().describe("GitHub PR number"),
199
- remediation_id: z
200
- .string()
201
- .optional()
202
- .describe("ID of the associated remediation record (if any)"),
203
- deferral_reason: z
204
- .string()
205
- .optional()
206
- .describe("Explanation for why the issue was deferred (for needs_more_data actions)"),
207
- dismissal_reason: z
208
- .string()
209
- .optional()
210
- .describe("Explanation for why the issue was dismissed (for dismissed/marked_intended actions)"),
211
- page_path: z
212
- .string()
213
- .optional()
214
- .describe("Page path affected by the fix (used for auto-creating remediation when remediation_id is not provided)"),
215
- element_selector: z
216
- .string()
217
- .optional()
218
- .describe("CSS selector of the affected element (used for auto-creating remediation)"),
219
- diagnosis: z
220
- .string()
221
- .optional()
222
- .describe("Root cause analysis (used for auto-creating remediation; defaults to hypothesis if not provided)"),
223
- proposed_fix: z
224
- .string()
225
- .optional()
226
- .describe("Fix description (used for auto-creating remediation; defaults to expected_improvement if not provided)"),
227
- confidence: z
228
- .number()
229
- .min(0)
230
- .max(1)
231
- .optional()
232
- .describe("Fix confidence 0-1 (used for auto-creating remediation; defaults to 0.7)"),
233
- }),
234
- }, async ({ run_id, issue_id, action_type, hypothesis, expected_improvement, code_changes, pr_url, pr_number, remediation_id, deferral_reason, dismissal_reason, page_path, element_selector, diagnosis, proposed_fix, confidence, }) => {
235
- if (!isApiConfigured()) {
236
- return {
237
- content: [
238
- {
239
- type: "text",
240
- text: JSON.stringify({ error: "API not configured" }),
241
- },
242
- ],
243
- isError: true,
244
- };
245
- }
246
- const { data, error } = await apiPost(`/improvement-runs/${run_id}/actions`, {
247
- issue_id,
248
- action_type,
249
- hypothesis,
250
- expected_improvement,
251
- code_changes,
252
- pr_url,
253
- pr_number,
254
- remediation_id,
255
- deferral_reason,
256
- dismissal_reason,
257
- page_path,
258
- element_selector,
259
- diagnosis,
260
- proposed_fix,
261
- confidence,
262
- });
263
- if (error) {
264
- return {
265
- content: [{ type: "text", text: JSON.stringify({ error }) }],
266
- isError: true,
267
- };
268
- }
269
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
270
- });
271
- server.registerTool("update_improvement_action", {
272
- description: "Update an existing improvement run action with PR information. Use this after a PR has been created to link it to the action. " +
273
- "This is especially useful in GitHub Actions workflows where the PR is created after the action is recorded.",
274
- inputSchema: z.object({
275
- run_id: z.string().describe("The ID of the improvement run"),
276
- action_id: z.string().describe("The ID of the action to update"),
277
- pr_url: z
278
- .string()
279
- .optional()
280
- .describe("GitHub PR URL to link to this action"),
281
- pr_number: z
282
- .number()
283
- .optional()
284
- .describe("GitHub PR number to link to this action"),
285
- }),
286
- }, async ({ run_id, action_id, pr_url, pr_number, }) => {
287
- if (!isApiConfigured()) {
288
- return {
289
- content: [
290
- {
291
- type: "text",
292
- text: JSON.stringify({ error: "API not configured" }),
293
- },
294
- ],
295
- isError: true,
296
- };
297
- }
298
- const { data, error } = await apiPatch(`/improvement-runs/${run_id}/actions/${action_id}`, {
299
- pr_url,
300
- pr_number,
301
- });
302
- if (error) {
303
- return {
304
- content: [{ type: "text", text: JSON.stringify({ error }) }],
305
- isError: true,
306
- };
307
- }
308
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
309
- });
310
- server.registerTool("get_improvement_run", {
311
- description: "Get details of a specific improvement run including all actions taken. Use to review what happened during a run.",
312
- inputSchema: z.object({
313
- run_id: z
314
- .string()
315
- .describe("The ID of the improvement run to retrieve"),
316
- }),
317
- }, async ({ run_id }) => {
318
- if (!isApiConfigured()) {
319
- return {
320
- content: [
321
- {
322
- type: "text",
323
- text: JSON.stringify({ error: "API not configured" }),
324
- },
325
- ],
326
- isError: true,
327
- };
328
- }
329
- const { data, error } = await apiGet(`/improvement-runs/${run_id}`);
330
- if (error) {
331
- return {
332
- content: [{ type: "text", text: JSON.stringify({ error }) }],
333
- isError: true,
334
- };
335
- }
336
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
337
- });
338
- server.registerTool("list_improvement_runs", {
339
- description: "List recent improvement runs with optional filters. Use to review past runs and their outcomes.",
340
- inputSchema: z.object({
341
- status: z
342
- .enum(["running", "completed", "failed", "cancelled"])
343
- .optional()
344
- .describe("Filter by run status"),
345
- trigger_type: z
346
- .enum(["github_actions", "cron", "manual", "api"])
347
- .optional()
348
- .describe("Filter by trigger type"),
349
- limit: z
350
- .number()
351
- .optional()
352
- .default(20)
353
- .describe("Maximum number of results (default: 20)"),
354
- offset: z
355
- .number()
356
- .optional()
357
- .default(0)
358
- .describe("Offset for pagination"),
359
- }),
360
- }, async ({ status, trigger_type, limit, offset, }) => {
361
- if (!isApiConfigured()) {
362
- return {
363
- content: [
364
- {
365
- type: "text",
366
- text: JSON.stringify({ error: "API not configured" }),
367
- },
368
- ],
369
- isError: true,
370
- };
371
- }
372
- const { data, error } = await apiGet("/improvement-runs", {
373
- status,
374
- trigger_type,
375
- limit: limit ?? 20,
376
- offset: offset ?? 0,
377
- });
378
- if (error) {
379
- return {
380
- content: [{ type: "text", text: JSON.stringify({ error }) }],
381
- isError: true,
382
- };
383
- }
384
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
385
- });
386
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * Knowledge tools for self-improvement workflow.
3
- *
4
- * Provides site-specific knowledge management for learning from past fixes.
5
- */
6
- export declare function registerKnowledgeTools(server: any): void;
@@ -1,186 +0,0 @@
1
- /**
2
- * Knowledge tools for self-improvement workflow.
3
- *
4
- * Provides site-specific knowledge management for learning from past fixes.
5
- */
6
- import { z } from "zod";
7
- import { apiGet, apiPost, apiDelete, isApiConfigured } from "../api/client.js";
8
- const KNOWLEDGE_CATEGORIES = [
9
- "false_positive",
10
- "intended_behavior",
11
- "fix_pattern",
12
- "context",
13
- ];
14
- const ISSUE_CATEGORIES = [
15
- "code_error",
16
- "dead_click",
17
- "rage_click",
18
- "ux_friction",
19
- "performance",
20
- "form_issue",
21
- "behavioral_anomaly",
22
- "structural_issue",
23
- ];
24
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
- export function registerKnowledgeTools(server) {
26
- server.registerTool("get_site_knowledge", {
27
- description: "Retrieve site-specific learnings including known false positives, intended behaviors, and successful fix patterns. Use at the start of a self-improvement workflow to avoid re-flagging known issues.",
28
- inputSchema: z.object({
29
- category: z
30
- .enum(KNOWLEDGE_CATEGORIES)
31
- .optional()
32
- .describe("Filter by knowledge category"),
33
- page_path: z.string().optional().describe("Filter by page path"),
34
- issue_category: z
35
- .enum(ISSUE_CATEGORIES)
36
- .optional()
37
- .describe("Filter by issue category"),
38
- limit: z
39
- .number()
40
- .optional()
41
- .default(50)
42
- .describe("Maximum number of entries to return (default: 50)"),
43
- }),
44
- }, async ({ category, page_path, issue_category, limit, }) => {
45
- if (!isApiConfigured()) {
46
- return {
47
- content: [
48
- {
49
- type: "text",
50
- text: JSON.stringify({ error: "API not configured" }),
51
- },
52
- ],
53
- isError: true,
54
- };
55
- }
56
- const { data, error } = await apiGet("/knowledge", {
57
- category,
58
- page_path,
59
- issue_category,
60
- limit: limit ?? 50,
61
- });
62
- if (error) {
63
- return {
64
- content: [{ type: "text", text: JSON.stringify({ error }) }],
65
- isError: true,
66
- };
67
- }
68
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
69
- });
70
- server.registerTool("add_site_knowledge", {
71
- description: "Store a site-specific learning. Use to record false positives, intended behaviors, successful fix patterns, or important context about the site.",
72
- inputSchema: z.object({
73
- category: z
74
- .enum(KNOWLEDGE_CATEGORIES)
75
- .describe("Category of knowledge: false_positive, intended_behavior, fix_pattern, or context"),
76
- subject: z
77
- .string()
78
- .describe("Unique identifier/title for this knowledge entry"),
79
- content: z.string().describe("Detailed description of the learning"),
80
- page_path: z
81
- .string()
82
- .optional()
83
- .describe("Associated page path (if applicable)"),
84
- element_selector: z
85
- .string()
86
- .optional()
87
- .describe("Associated element selector (if applicable)"),
88
- issue_category: z
89
- .enum(ISSUE_CATEGORIES)
90
- .optional()
91
- .describe("Associated issue category (if applicable)"),
92
- }),
93
- }, async ({ category, subject, content, page_path, element_selector, issue_category, }) => {
94
- if (!isApiConfigured()) {
95
- return {
96
- content: [
97
- {
98
- type: "text",
99
- text: JSON.stringify({ error: "API not configured" }),
100
- },
101
- ],
102
- isError: true,
103
- };
104
- }
105
- const { data, error } = await apiPost("/knowledge", {
106
- category,
107
- subject,
108
- content,
109
- page_path,
110
- element_selector,
111
- issue_category,
112
- source: "agent",
113
- });
114
- if (error) {
115
- return {
116
- content: [{ type: "text", text: JSON.stringify({ error }) }],
117
- isError: true,
118
- };
119
- }
120
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
121
- });
122
- server.registerTool("delete_site_knowledge", {
123
- description: "Delete a site knowledge entry. Use when a learning is no longer valid or was created in error.",
124
- inputSchema: z.object({
125
- knowledge_id: z
126
- .string()
127
- .describe("The ID of the knowledge entry to delete"),
128
- }),
129
- }, async ({ knowledge_id }) => {
130
- if (!isApiConfigured()) {
131
- return {
132
- content: [
133
- {
134
- type: "text",
135
- text: JSON.stringify({ error: "API not configured" }),
136
- },
137
- ],
138
- isError: true,
139
- };
140
- }
141
- const { data, error } = await apiDelete(`/knowledge/${knowledge_id}`);
142
- if (error) {
143
- return {
144
- content: [{ type: "text", text: JSON.stringify({ error }) }],
145
- isError: true,
146
- };
147
- }
148
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
149
- });
150
- server.registerTool("get_similar_fixes", {
151
- description: "Find past fixes for similar issues. Returns successful and failed remediation attempts for issues with the same category, page, or element. Use before proposing a fix to learn from past attempts.",
152
- inputSchema: z.object({
153
- issue_id: z
154
- .string()
155
- .describe("The ID of the issue to find similar fixes for"),
156
- limit: z
157
- .number()
158
- .optional()
159
- .default(5)
160
- .describe("Maximum number of similar fixes to return (default: 5)"),
161
- }),
162
- }, async ({ issue_id, limit }) => {
163
- if (!isApiConfigured()) {
164
- return {
165
- content: [
166
- {
167
- type: "text",
168
- text: JSON.stringify({ error: "API not configured" }),
169
- },
170
- ],
171
- isError: true,
172
- };
173
- }
174
- const { data, error } = await apiGet("/knowledge/similar-fixes", {
175
- issue_id,
176
- limit: limit ?? 5,
177
- });
178
- if (error) {
179
- return {
180
- content: [{ type: "text", text: JSON.stringify({ error }) }],
181
- isError: true,
182
- };
183
- }
184
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
185
- });
186
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * list_pages tool
3
- *
4
- * List all tracked pages with basic metrics.
5
- */
6
- export declare function registerListPages(server: any): void;
@@ -1,50 +0,0 @@
1
- /**
2
- * list_pages tool
3
- *
4
- * List all tracked pages with basic metrics.
5
- */
6
- import { z } from "zod";
7
- import { apiGet, isApiConfigured } from "../api/client.js";
8
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
- export function registerListPages(server) {
10
- server.registerTool("list_pages", {
11
- description: "List all tracked pages with basic metrics. " +
12
- "Returns page paths sorted by session count with frustration and health grade. " +
13
- "Use this to discover what pages are being tracked before diving into specific pages.",
14
- inputSchema: z.object({
15
- days: z
16
- .number()
17
- .optional()
18
- .default(7)
19
- .describe("Number of days to look back (default 7)"),
20
- limit: z
21
- .number()
22
- .optional()
23
- .default(50)
24
- .describe("Maximum number of pages to return (default 50)"),
25
- }),
26
- }, async ({ days, limit }) => {
27
- if (!isApiConfigured()) {
28
- return {
29
- content: [
30
- {
31
- type: "text",
32
- text: JSON.stringify({ error: "API not configured" }),
33
- },
34
- ],
35
- isError: true,
36
- };
37
- }
38
- const { data, error } = await apiGet("/pages/list", {
39
- days: days ?? 7,
40
- limit: limit ?? 50,
41
- });
42
- if (error) {
43
- return {
44
- content: [{ type: "text", text: JSON.stringify({ error }) }],
45
- isError: true,
46
- };
47
- }
48
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
49
- });
50
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * list_sessions tool
3
- *
4
- * Lists and filters recorded sessions.
5
- * Thin proxy to external-api /sessions endpoint.
6
- */
7
- export declare function registerListSessions(server: any): void;