@recapt/mcp 0.0.18-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 -18
- package/dist/index.js +3205 -247
- package/dist/tools/catalog/anthropicToolCatalog.json +1306 -0
- package/dist/tools/catalog/toolCatalog.json +4078 -382
- package/package.json +10 -3
- package/skills/self-improvement.md +388 -222
- package/templates/self-improvement-full.md +91 -0
- package/templates/{self-improvement.md → self-improvement-lite.md} +13 -9
- package/dist/api/client.d.ts +0 -14
- package/dist/api/client.js +0 -67
- 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 -173
- 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 -315
- 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 -223
- 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
package/dist/tools/knowledge.js
DELETED
|
@@ -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
|
-
}
|
package/dist/tools/listPages.js
DELETED
|
@@ -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,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
|
-
}
|