@recapt/mcp 0.0.19-beta → 0.0.20-beta
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/dist/cli/index.d.ts +0 -11
- package/dist/cli/index.js +1059 -21
- package/dist/index.d.ts +0 -19
- package/dist/index.js +3210 -89
- package/package.json +5 -3
- package/dist/api/client.d.ts +0 -6
- package/dist/api/client.js +0 -6
- package/dist/cli/commands/setup-self-improvement-gh.d.ts +0 -7
- package/dist/cli/commands/setup-self-improvement-gh.js +0 -310
- package/dist/cli/commands/setup.d.ts +0 -7
- package/dist/cli/commands/setup.js +0 -178
- package/dist/cli/commands/skill.d.ts +0 -24
- package/dist/cli/commands/skill.js +0 -264
- package/dist/cli/utils/ide-config.d.ts +0 -31
- package/dist/cli/utils/ide-config.js +0 -294
- package/dist/cli/utils/prompts.d.ts +0 -22
- package/dist/cli/utils/prompts.js +0 -71
- package/dist/tools/analyzeFlow.d.ts +0 -7
- package/dist/tools/analyzeFlow.js +0 -68
- package/dist/tools/analyzeFunnel.d.ts +0 -7
- package/dist/tools/analyzeFunnel.js +0 -63
- package/dist/tools/catalog/callTool.d.ts +0 -22
- package/dist/tools/catalog/callTool.js +0 -92
- package/dist/tools/catalog/index.d.ts +0 -11
- package/dist/tools/catalog/index.js +0 -11
- package/dist/tools/catalog/searchTools.d.ts +0 -22
- package/dist/tools/catalog/searchTools.js +0 -194
- package/dist/tools/compareCohorts.d.ts +0 -6
- package/dist/tools/compareCohorts.js +0 -84
- package/dist/tools/comparePeriods.d.ts +0 -6
- package/dist/tools/comparePeriods.js +0 -54
- package/dist/tools/detectDrift.d.ts +0 -6
- package/dist/tools/detectDrift.js +0 -55
- package/dist/tools/detectRegressions.d.ts +0 -6
- package/dist/tools/detectRegressions.js +0 -63
- package/dist/tools/diagnostic.d.ts +0 -6
- package/dist/tools/diagnostic.js +0 -109
- package/dist/tools/discoverPersonas.d.ts +0 -6
- package/dist/tools/discoverPersonas.js +0 -50
- package/dist/tools/getActionableIssues.d.ts +0 -7
- package/dist/tools/getActionableIssues.js +0 -55
- package/dist/tools/getAnomalies.d.ts +0 -6
- package/dist/tools/getAnomalies.js +0 -53
- package/dist/tools/getConsoleErrors.d.ts +0 -6
- package/dist/tools/getConsoleErrors.js +0 -61
- package/dist/tools/getDeadClicks.d.ts +0 -6
- package/dist/tools/getDeadClicks.js +0 -42
- package/dist/tools/getDomains.d.ts +0 -6
- package/dist/tools/getDomains.js +0 -34
- package/dist/tools/getElementFriction.d.ts +0 -6
- package/dist/tools/getElementFriction.js +0 -45
- package/dist/tools/getFlowFriction.d.ts +0 -7
- package/dist/tools/getFlowFriction.js +0 -57
- package/dist/tools/getFormFriction.d.ts +0 -6
- package/dist/tools/getFormFriction.js +0 -42
- package/dist/tools/getIssues.d.ts +0 -6
- package/dist/tools/getIssues.js +0 -82
- package/dist/tools/getJourneyPatterns.d.ts +0 -7
- package/dist/tools/getJourneyPatterns.js +0 -50
- package/dist/tools/getPageMetrics.d.ts +0 -6
- package/dist/tools/getPageMetrics.js +0 -47
- package/dist/tools/getPageTrends.d.ts +0 -6
- package/dist/tools/getPageTrends.js +0 -46
- package/dist/tools/getSessionDetails.d.ts +0 -6
- package/dist/tools/getSessionDetails.js +0 -70
- package/dist/tools/getSessionPages.d.ts +0 -7
- package/dist/tools/getSessionPages.js +0 -74
- package/dist/tools/getUxHealthReport.d.ts +0 -7
- package/dist/tools/getUxHealthReport.js +0 -50
- package/dist/tools/improvementRun.d.ts +0 -6
- package/dist/tools/improvementRun.js +0 -386
- package/dist/tools/knowledge.d.ts +0 -6
- package/dist/tools/knowledge.js +0 -186
- package/dist/tools/listPages.d.ts +0 -6
- package/dist/tools/listPages.js +0 -50
- package/dist/tools/listSessions.d.ts +0 -7
- package/dist/tools/listSessions.js +0 -67
- package/dist/tools/memory.d.ts +0 -7
- package/dist/tools/memory.js +0 -119
- package/dist/tools/predictOutcomes.d.ts +0 -6
- package/dist/tools/predictOutcomes.js +0 -66
- package/dist/tools/remediation.d.ts +0 -6
- package/dist/tools/remediation.js +0 -335
- package/dist/tools/scanSite.d.ts +0 -6
- package/dist/tools/scanSite.js +0 -51
- package/dist/tools/searchSessions.d.ts +0 -6
- package/dist/tools/searchSessions.js +0 -51
- package/dist/tools/triage.d.ts +0 -6
- package/dist/tools/triage.js +0 -114
- package/dist/tools/triageSessions.d.ts +0 -8
- package/dist/tools/triageSessions.js +0 -197
- package/dist/tools/upgradeOptions.d.ts +0 -7
- package/dist/tools/upgradeOptions.js +0 -67
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* list_sessions tool
|
|
3
|
-
*
|
|
4
|
-
* Lists and filters recorded sessions.
|
|
5
|
-
* Thin proxy to external-api /sessions endpoint.
|
|
6
|
-
*/
|
|
7
|
-
import { z } from "zod";
|
|
8
|
-
import { apiGet, isApiConfigured } from "../api/client.js";
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
-
export function registerListSessions(server) {
|
|
11
|
-
server.registerTool("list_sessions", {
|
|
12
|
-
description: "List and filter recorded sessions. Returns session metadata including status, " +
|
|
13
|
-
"duration, device, browser, and domains. Use to find sessions for a domain, " +
|
|
14
|
-
"check for active sessions, or browse by device type.",
|
|
15
|
-
inputSchema: z.object({
|
|
16
|
-
domain: z
|
|
17
|
-
.string()
|
|
18
|
-
.optional()
|
|
19
|
-
.describe("Filter by domain name (partial match supported)"),
|
|
20
|
-
status: z
|
|
21
|
-
.enum(["active", "terminated", "all"])
|
|
22
|
-
.optional()
|
|
23
|
-
.default("all")
|
|
24
|
-
.describe("Filter by session status"),
|
|
25
|
-
device: z
|
|
26
|
-
.enum(["desktop", "mobile", "tablet"])
|
|
27
|
-
.optional()
|
|
28
|
-
.describe("Filter by device type"),
|
|
29
|
-
days: z
|
|
30
|
-
.number()
|
|
31
|
-
.optional()
|
|
32
|
-
.default(7)
|
|
33
|
-
.describe("Number of days to look back (default: 7)"),
|
|
34
|
-
limit: z
|
|
35
|
-
.number()
|
|
36
|
-
.optional()
|
|
37
|
-
.default(20)
|
|
38
|
-
.describe("Maximum sessions to return (default: 20, max: 200)"),
|
|
39
|
-
}),
|
|
40
|
-
}, async ({ domain, status, device, days, limit, }) => {
|
|
41
|
-
if (!isApiConfigured()) {
|
|
42
|
-
return {
|
|
43
|
-
content: [
|
|
44
|
-
{
|
|
45
|
-
type: "text",
|
|
46
|
-
text: JSON.stringify({ error: "API not configured" }),
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
isError: true,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
const { data, error } = await apiGet("/sessions", {
|
|
53
|
-
domain,
|
|
54
|
-
status: status === "all" ? undefined : status,
|
|
55
|
-
device,
|
|
56
|
-
days: days ?? 7,
|
|
57
|
-
limit: limit ?? 20,
|
|
58
|
-
});
|
|
59
|
-
if (error) {
|
|
60
|
-
return {
|
|
61
|
-
content: [{ type: "text", text: JSON.stringify({ error }) }],
|
|
62
|
-
isError: true,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
66
|
-
});
|
|
67
|
-
}
|
package/dist/tools/memory.d.ts
DELETED
package/dist/tools/memory.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Memory management tools for MCP sessions.
|
|
3
|
-
*
|
|
4
|
-
* Provides working memory for AI agents to store intermediate results
|
|
5
|
-
* and query across stored data without re-fetching.
|
|
6
|
-
*/
|
|
7
|
-
import { z } from "zod";
|
|
8
|
-
const memoryStore = new Map();
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
-
export function registerMemoryTools(server) {
|
|
11
|
-
server.registerTool("memory_save", {
|
|
12
|
-
description: "Save a value to working memory for later retrieval. " +
|
|
13
|
-
"Use this to store intermediate results from tool calls that you want to reference later.",
|
|
14
|
-
inputSchema: z.object({
|
|
15
|
-
key: z.string().describe("Unique key to store the value under"),
|
|
16
|
-
value: z.string().describe("Value to store (will be stored as string)"),
|
|
17
|
-
annotation: z
|
|
18
|
-
.string()
|
|
19
|
-
.optional()
|
|
20
|
-
.describe("Optional note about what this data represents"),
|
|
21
|
-
}),
|
|
22
|
-
}, async ({ key, value, annotation, }) => {
|
|
23
|
-
memoryStore.set(key, {
|
|
24
|
-
key,
|
|
25
|
-
value,
|
|
26
|
-
timestamp: Date.now(),
|
|
27
|
-
annotation,
|
|
28
|
-
});
|
|
29
|
-
return {
|
|
30
|
-
content: [
|
|
31
|
-
{
|
|
32
|
-
type: "text",
|
|
33
|
-
text: JSON.stringify({ success: true, key, size: value.length }),
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
server.registerTool("memory_recall", {
|
|
39
|
-
description: "Retrieve a value from working memory by key. " +
|
|
40
|
-
"Use this to access data you previously stored with memory_save.",
|
|
41
|
-
inputSchema: z.object({
|
|
42
|
-
key: z.string().describe("Key to retrieve"),
|
|
43
|
-
}),
|
|
44
|
-
}, async ({ key }) => {
|
|
45
|
-
const entry = memoryStore.get(key);
|
|
46
|
-
if (!entry) {
|
|
47
|
-
return {
|
|
48
|
-
content: [
|
|
49
|
-
{
|
|
50
|
-
type: "text",
|
|
51
|
-
text: JSON.stringify({
|
|
52
|
-
error: `Key "${key}" not found in memory`,
|
|
53
|
-
}),
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
isError: true,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
content: [
|
|
61
|
-
{
|
|
62
|
-
type: "text",
|
|
63
|
-
text: entry.value,
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
};
|
|
67
|
-
});
|
|
68
|
-
server.registerTool("memory_list", {
|
|
69
|
-
description: "List all keys currently stored in working memory. " +
|
|
70
|
-
"Returns key names, sizes, timestamps, and annotations.",
|
|
71
|
-
inputSchema: z.object({}),
|
|
72
|
-
}, async () => {
|
|
73
|
-
const entries = [...memoryStore.values()].map((entry) => ({
|
|
74
|
-
key: entry.key,
|
|
75
|
-
size: entry.value.length,
|
|
76
|
-
timestamp: new Date(entry.timestamp).toISOString(),
|
|
77
|
-
annotation: entry.annotation,
|
|
78
|
-
}));
|
|
79
|
-
return {
|
|
80
|
-
content: [
|
|
81
|
-
{
|
|
82
|
-
type: "text",
|
|
83
|
-
text: JSON.stringify({ count: entries.length, entries }),
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
};
|
|
87
|
-
});
|
|
88
|
-
server.registerTool("memory_delete", {
|
|
89
|
-
description: "Delete a value from working memory by key.",
|
|
90
|
-
inputSchema: z.object({
|
|
91
|
-
key: z.string().describe("Key to delete"),
|
|
92
|
-
}),
|
|
93
|
-
}, async ({ key }) => {
|
|
94
|
-
const existed = memoryStore.delete(key);
|
|
95
|
-
return {
|
|
96
|
-
content: [
|
|
97
|
-
{
|
|
98
|
-
type: "text",
|
|
99
|
-
text: JSON.stringify({ success: true, deleted: existed }),
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
};
|
|
103
|
-
});
|
|
104
|
-
server.registerTool("memory_clear", {
|
|
105
|
-
description: "Clear all values from working memory. Use with caution.",
|
|
106
|
-
inputSchema: z.object({}),
|
|
107
|
-
}, async () => {
|
|
108
|
-
const count = memoryStore.size;
|
|
109
|
-
memoryStore.clear();
|
|
110
|
-
return {
|
|
111
|
-
content: [
|
|
112
|
-
{
|
|
113
|
-
type: "text",
|
|
114
|
-
text: JSON.stringify({ success: true, cleared: count }),
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
};
|
|
118
|
-
});
|
|
119
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* predict_outcomes tool
|
|
3
|
-
*
|
|
4
|
-
* Predict session outcomes based on behavioral features.
|
|
5
|
-
*/
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
import { apiPost, isApiConfigured } from "../api/client.js";
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
-
export function registerPredictOutcomes(server) {
|
|
10
|
-
server.registerTool("predict_outcomes", {
|
|
11
|
-
description: "Predict session outcomes based on early behavioral signals. " +
|
|
12
|
-
"Provide either a session_id to analyze an existing session, or behavioral_features " +
|
|
13
|
-
"to predict outcomes for hypothetical scenarios. " +
|
|
14
|
-
"Returns predicted outcome (COMPLETED, STRUGGLED, BLOCKED, DISENGAGED) with confidence.",
|
|
15
|
-
inputSchema: z.object({
|
|
16
|
-
session_id: z
|
|
17
|
-
.string()
|
|
18
|
-
.optional()
|
|
19
|
-
.describe("Session ID to analyze and predict outcome for"),
|
|
20
|
-
behavioral_features: z
|
|
21
|
-
.object({
|
|
22
|
-
frustration: z.number().describe("Frustration score (0-1)"),
|
|
23
|
-
confusion: z.number().describe("Confusion score (0-1)"),
|
|
24
|
-
confidence: z.number().describe("Confidence score (0-1)"),
|
|
25
|
-
})
|
|
26
|
-
.optional()
|
|
27
|
-
.describe("Behavioral features to use for prediction"),
|
|
28
|
-
}),
|
|
29
|
-
}, async ({ session_id, behavioral_features, }) => {
|
|
30
|
-
if (!isApiConfigured()) {
|
|
31
|
-
return {
|
|
32
|
-
content: [
|
|
33
|
-
{
|
|
34
|
-
type: "text",
|
|
35
|
-
text: JSON.stringify({ error: "API not configured" }),
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
isError: true,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
if (!session_id && !behavioral_features) {
|
|
42
|
-
return {
|
|
43
|
-
content: [
|
|
44
|
-
{
|
|
45
|
-
type: "text",
|
|
46
|
-
text: JSON.stringify({
|
|
47
|
-
error: "Either session_id or behavioral_features is required",
|
|
48
|
-
}),
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
isError: true,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
const { data, error } = await apiPost("/predict", {
|
|
55
|
-
session_id,
|
|
56
|
-
behavioral_features,
|
|
57
|
-
});
|
|
58
|
-
if (error) {
|
|
59
|
-
return {
|
|
60
|
-
content: [{ type: "text", text: JSON.stringify({ error }) }],
|
|
61
|
-
isError: true,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
65
|
-
});
|
|
66
|
-
}
|
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Remediation tools for self-improvement workflow.
|
|
3
|
-
*
|
|
4
|
-
* Provides fix proposal, deployment confirmation, evaluation, and history tracking.
|
|
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 registerRemediationTools(server) {
|
|
10
|
-
server.registerTool("propose_fix", {
|
|
11
|
-
description: "Propose a fix for an issue. Creates a remediation record with baseline metrics for later evaluation. Include detailed diagnosis and code suggestions when possible.",
|
|
12
|
-
inputSchema: z.object({
|
|
13
|
-
issue_id: z.string().describe("The ID of the issue to fix"),
|
|
14
|
-
diagnosis: z
|
|
15
|
-
.string()
|
|
16
|
-
.describe("Detailed analysis of the root cause of the issue"),
|
|
17
|
-
proposed_fix: z
|
|
18
|
-
.string()
|
|
19
|
-
.describe("Description of the proposed fix and how it addresses the root cause"),
|
|
20
|
-
code_snippet: z
|
|
21
|
-
.string()
|
|
22
|
-
.optional()
|
|
23
|
-
.describe("Suggested code changes (if applicable)"),
|
|
24
|
-
affected_files: z
|
|
25
|
-
.array(z.string())
|
|
26
|
-
.optional()
|
|
27
|
-
.describe("List of files that need to be modified"),
|
|
28
|
-
confidence: z
|
|
29
|
-
.number()
|
|
30
|
-
.min(0)
|
|
31
|
-
.max(1)
|
|
32
|
-
.describe("Confidence level in the fix (0-1). Use <0.7 when uncertain."),
|
|
33
|
-
}),
|
|
34
|
-
}, async ({ issue_id, diagnosis, proposed_fix, code_snippet, affected_files, confidence, }) => {
|
|
35
|
-
if (!isApiConfigured()) {
|
|
36
|
-
return {
|
|
37
|
-
content: [
|
|
38
|
-
{
|
|
39
|
-
type: "text",
|
|
40
|
-
text: JSON.stringify({ error: "API not configured" }),
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
isError: true,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
const { data, error } = await apiPost("/remediations", {
|
|
47
|
-
issue_id,
|
|
48
|
-
diagnosis,
|
|
49
|
-
proposed_fix,
|
|
50
|
-
code_snippet,
|
|
51
|
-
affected_files,
|
|
52
|
-
confidence,
|
|
53
|
-
});
|
|
54
|
-
if (error) {
|
|
55
|
-
return {
|
|
56
|
-
content: [{ type: "text", text: JSON.stringify({ error }) }],
|
|
57
|
-
isError: true,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
61
|
-
});
|
|
62
|
-
server.registerTool("list_pending_fixes", {
|
|
63
|
-
description: "List all proposed fixes awaiting deployment. Use to show the user what fixes are ready to be deployed.",
|
|
64
|
-
inputSchema: z.object({}),
|
|
65
|
-
}, async () => {
|
|
66
|
-
if (!isApiConfigured()) {
|
|
67
|
-
return {
|
|
68
|
-
content: [
|
|
69
|
-
{
|
|
70
|
-
type: "text",
|
|
71
|
-
text: JSON.stringify({ error: "API not configured" }),
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
isError: true,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
const { data, error } = await apiGet("/remediations/pending");
|
|
78
|
-
if (error) {
|
|
79
|
-
return {
|
|
80
|
-
content: [{ type: "text", text: JSON.stringify({ error }) }],
|
|
81
|
-
isError: true,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
85
|
-
});
|
|
86
|
-
server.registerTool("list_remediations", {
|
|
87
|
-
description: "List remediation records with optional filters. Use to review past and current fix attempts.",
|
|
88
|
-
inputSchema: z.object({
|
|
89
|
-
status: z
|
|
90
|
-
.enum([
|
|
91
|
-
"proposed",
|
|
92
|
-
"waiting",
|
|
93
|
-
"dismissed",
|
|
94
|
-
"deployed",
|
|
95
|
-
"evaluating",
|
|
96
|
-
"succeeded",
|
|
97
|
-
"failed",
|
|
98
|
-
"reverted",
|
|
99
|
-
])
|
|
100
|
-
.optional()
|
|
101
|
-
.describe("Filter by remediation status"),
|
|
102
|
-
issue_id: z.string().optional().describe("Filter by issue ID"),
|
|
103
|
-
page_path: z.string().optional().describe("Filter by page path"),
|
|
104
|
-
limit: z
|
|
105
|
-
.number()
|
|
106
|
-
.optional()
|
|
107
|
-
.default(20)
|
|
108
|
-
.describe("Maximum number of results (default: 20)"),
|
|
109
|
-
}),
|
|
110
|
-
}, async ({ status, issue_id, page_path, limit, }) => {
|
|
111
|
-
if (!isApiConfigured()) {
|
|
112
|
-
return {
|
|
113
|
-
content: [
|
|
114
|
-
{
|
|
115
|
-
type: "text",
|
|
116
|
-
text: JSON.stringify({ error: "API not configured" }),
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
isError: true,
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
const { data, error } = await apiGet("/remediations", {
|
|
123
|
-
status,
|
|
124
|
-
issue_id,
|
|
125
|
-
page_path,
|
|
126
|
-
limit: limit ?? 20,
|
|
127
|
-
});
|
|
128
|
-
if (error) {
|
|
129
|
-
return {
|
|
130
|
-
content: [{ type: "text", text: JSON.stringify({ error }) }],
|
|
131
|
-
isError: true,
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
135
|
-
});
|
|
136
|
-
server.registerTool("confirm_deployment", {
|
|
137
|
-
description: "Confirm that a proposed fix has been deployed to production. This starts the evaluation timer. Call this when the user confirms they have deployed the fix.",
|
|
138
|
-
inputSchema: z.object({
|
|
139
|
-
remediation_id: z
|
|
140
|
-
.string()
|
|
141
|
-
.describe("The ID of the remediation to mark as deployed"),
|
|
142
|
-
}),
|
|
143
|
-
}, async ({ remediation_id }) => {
|
|
144
|
-
if (!isApiConfigured()) {
|
|
145
|
-
return {
|
|
146
|
-
content: [
|
|
147
|
-
{
|
|
148
|
-
type: "text",
|
|
149
|
-
text: JSON.stringify({ error: "API not configured" }),
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
isError: true,
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
const { data, error } = await apiPatch(`/remediations/${remediation_id}/deploy`, {});
|
|
156
|
-
if (error) {
|
|
157
|
-
return {
|
|
158
|
-
content: [{ type: "text", text: JSON.stringify({ error }) }],
|
|
159
|
-
isError: true,
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
163
|
-
});
|
|
164
|
-
server.registerTool("evaluate_fix", {
|
|
165
|
-
description: "Evaluate if a deployed fix improved metrics. Compares post-deployment metrics to baseline. Returns success/partial/failed outcome with detailed verdict. Wait at least 24 hours after deployment for reliable results.",
|
|
166
|
-
inputSchema: z.object({
|
|
167
|
-
remediation_id: z
|
|
168
|
-
.string()
|
|
169
|
-
.describe("The ID of the remediation to evaluate"),
|
|
170
|
-
min_hours: z
|
|
171
|
-
.number()
|
|
172
|
-
.optional()
|
|
173
|
-
.default(24)
|
|
174
|
-
.describe("Minimum hours since deployment required (default: 24)"),
|
|
175
|
-
}),
|
|
176
|
-
}, async ({ remediation_id, min_hours, }) => {
|
|
177
|
-
if (!isApiConfigured()) {
|
|
178
|
-
return {
|
|
179
|
-
content: [
|
|
180
|
-
{
|
|
181
|
-
type: "text",
|
|
182
|
-
text: JSON.stringify({ error: "API not configured" }),
|
|
183
|
-
},
|
|
184
|
-
],
|
|
185
|
-
isError: true,
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
const { data, error } = await apiPost(`/remediations/${remediation_id}/evaluate`, { min_hours: min_hours ?? 24 });
|
|
189
|
-
if (error) {
|
|
190
|
-
return {
|
|
191
|
-
content: [{ type: "text", text: JSON.stringify({ error }) }],
|
|
192
|
-
isError: true,
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
196
|
-
});
|
|
197
|
-
server.registerTool("get_fix_history", {
|
|
198
|
-
description: "Get the full remediation history for an issue. Shows all fix attempts, their outcomes, and current status. Use before proposing a new fix to learn from past attempts.",
|
|
199
|
-
inputSchema: z.object({
|
|
200
|
-
issue_id: z
|
|
201
|
-
.string()
|
|
202
|
-
.describe("The ID of the issue to get fix history for"),
|
|
203
|
-
}),
|
|
204
|
-
}, async ({ issue_id }) => {
|
|
205
|
-
if (!isApiConfigured()) {
|
|
206
|
-
return {
|
|
207
|
-
content: [
|
|
208
|
-
{
|
|
209
|
-
type: "text",
|
|
210
|
-
text: JSON.stringify({ error: "API not configured" }),
|
|
211
|
-
},
|
|
212
|
-
],
|
|
213
|
-
isError: true,
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
const { data, error } = await apiGet(`/remediations/history/${issue_id}`);
|
|
217
|
-
if (error) {
|
|
218
|
-
return {
|
|
219
|
-
content: [{ type: "text", text: JSON.stringify({ error }) }],
|
|
220
|
-
isError: true,
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
224
|
-
});
|
|
225
|
-
server.registerTool("update_remediation_status", {
|
|
226
|
-
description: "Update the status of a remediation based on PR events. Use to mark a fix as 'waiting' (PR created), 'deployed' (PR merged), or 'dismissed' (PR closed without merge).",
|
|
227
|
-
inputSchema: z.object({
|
|
228
|
-
remediation_id: z
|
|
229
|
-
.string()
|
|
230
|
-
.describe("The ID of the remediation to update"),
|
|
231
|
-
status: z
|
|
232
|
-
.enum(["waiting", "deployed", "dismissed"])
|
|
233
|
-
.describe("New status: 'waiting' = PR open, 'deployed' = PR merged, 'dismissed' = PR closed without merge"),
|
|
234
|
-
pr_url: z.string().optional().describe("URL of the pull request"),
|
|
235
|
-
pr_number: z.number().optional().describe("PR number"),
|
|
236
|
-
pr_merged_at: z
|
|
237
|
-
.string()
|
|
238
|
-
.optional()
|
|
239
|
-
.describe("ISO timestamp when PR was merged"),
|
|
240
|
-
pr_closed_at: z
|
|
241
|
-
.string()
|
|
242
|
-
.optional()
|
|
243
|
-
.describe("ISO timestamp when PR was closed"),
|
|
244
|
-
}),
|
|
245
|
-
}, async ({ remediation_id, status, pr_url, pr_number, pr_merged_at, pr_closed_at, }) => {
|
|
246
|
-
if (!isApiConfigured()) {
|
|
247
|
-
return {
|
|
248
|
-
content: [
|
|
249
|
-
{
|
|
250
|
-
type: "text",
|
|
251
|
-
text: JSON.stringify({ error: "API not configured" }),
|
|
252
|
-
},
|
|
253
|
-
],
|
|
254
|
-
isError: true,
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
const { data, error } = await apiPatch(`/remediations/${remediation_id}/status`, {
|
|
258
|
-
status,
|
|
259
|
-
pr_url,
|
|
260
|
-
pr_number,
|
|
261
|
-
pr_merged_at,
|
|
262
|
-
pr_closed_at,
|
|
263
|
-
});
|
|
264
|
-
if (error) {
|
|
265
|
-
return {
|
|
266
|
-
content: [{ type: "text", text: JSON.stringify({ error }) }],
|
|
267
|
-
isError: true,
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
271
|
-
});
|
|
272
|
-
server.registerTool("list_remediations_by_status", {
|
|
273
|
-
description: "List remediations filtered by one or more statuses. Use to find all 'waiting' PRs or 'deployed' fixes ready for evaluation.",
|
|
274
|
-
inputSchema: z.object({
|
|
275
|
-
statuses: z
|
|
276
|
-
.array(z.enum([
|
|
277
|
-
"proposed",
|
|
278
|
-
"waiting",
|
|
279
|
-
"dismissed",
|
|
280
|
-
"deployed",
|
|
281
|
-
"evaluating",
|
|
282
|
-
"succeeded",
|
|
283
|
-
"failed",
|
|
284
|
-
"reverted",
|
|
285
|
-
]))
|
|
286
|
-
.describe("List of statuses to filter by"),
|
|
287
|
-
}),
|
|
288
|
-
}, async ({ statuses }) => {
|
|
289
|
-
if (!isApiConfigured()) {
|
|
290
|
-
return {
|
|
291
|
-
content: [
|
|
292
|
-
{
|
|
293
|
-
type: "text",
|
|
294
|
-
text: JSON.stringify({ error: "API not configured" }),
|
|
295
|
-
},
|
|
296
|
-
],
|
|
297
|
-
isError: true,
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
const { data, error } = await apiGet(`/remediations/by-status`, { statuses: statuses.join(",") });
|
|
301
|
-
if (error) {
|
|
302
|
-
return {
|
|
303
|
-
content: [{ type: "text", text: JSON.stringify({ error }) }],
|
|
304
|
-
isError: true,
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
308
|
-
});
|
|
309
|
-
server.registerTool("get_remediation_by_pr", {
|
|
310
|
-
description: "Get a remediation by its PR number. Use to look up fix details when processing PR events.",
|
|
311
|
-
inputSchema: z.object({
|
|
312
|
-
pr_number: z.number().describe("The PR number to look up"),
|
|
313
|
-
}),
|
|
314
|
-
}, async ({ pr_number }) => {
|
|
315
|
-
if (!isApiConfigured()) {
|
|
316
|
-
return {
|
|
317
|
-
content: [
|
|
318
|
-
{
|
|
319
|
-
type: "text",
|
|
320
|
-
text: JSON.stringify({ error: "API not configured" }),
|
|
321
|
-
},
|
|
322
|
-
],
|
|
323
|
-
isError: true,
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
const { data, error } = await apiGet(`/remediations/by-pr/${pr_number}`);
|
|
327
|
-
if (error) {
|
|
328
|
-
return {
|
|
329
|
-
content: [{ type: "text", text: JSON.stringify({ error }) }],
|
|
330
|
-
isError: true,
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
334
|
-
});
|
|
335
|
-
}
|
package/dist/tools/scanSite.d.ts
DELETED
package/dist/tools/scanSite.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* scan_site tool
|
|
3
|
-
*
|
|
4
|
-
* One-shot site health scan across all pages.
|
|
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 registerScanSite(server) {
|
|
10
|
-
server.registerTool("scan_site", {
|
|
11
|
-
description: "One-shot site health scan. Lists all pages and computes aggregate metrics " +
|
|
12
|
-
"for the top-N pages (default 10) sorted by session count. Returns a ranked " +
|
|
13
|
-
"table with frustration and health grade per page. " +
|
|
14
|
-
"Use this as the FIRST tool when the user asks a broad question without naming a specific page.",
|
|
15
|
-
inputSchema: z.object({
|
|
16
|
-
top_n: z
|
|
17
|
-
.number()
|
|
18
|
-
.optional()
|
|
19
|
-
.default(10)
|
|
20
|
-
.describe("Number of top pages to analyze (default 10)"),
|
|
21
|
-
offset: z
|
|
22
|
-
.number()
|
|
23
|
-
.optional()
|
|
24
|
-
.default(0)
|
|
25
|
-
.describe("Skip first N pages for pagination (default 0)"),
|
|
26
|
-
}),
|
|
27
|
-
}, async ({ top_n, offset }) => {
|
|
28
|
-
if (!isApiConfigured()) {
|
|
29
|
-
return {
|
|
30
|
-
content: [
|
|
31
|
-
{
|
|
32
|
-
type: "text",
|
|
33
|
-
text: JSON.stringify({ error: "API not configured" }),
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
isError: true,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
const { data, error } = await apiGet("/site/overview", {
|
|
40
|
-
top_n: top_n ?? 10,
|
|
41
|
-
offset: offset ?? 0,
|
|
42
|
-
});
|
|
43
|
-
if (error) {
|
|
44
|
-
return {
|
|
45
|
-
content: [{ type: "text", text: JSON.stringify({ error }) }],
|
|
46
|
-
isError: true,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
50
|
-
});
|
|
51
|
-
}
|