@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.
Files changed (98) 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 -18
  4. package/dist/index.js +3205 -247
  5. package/dist/tools/catalog/anthropicToolCatalog.json +1306 -0
  6. package/dist/tools/catalog/toolCatalog.json +4078 -382
  7. package/package.json +10 -3
  8. package/skills/self-improvement.md +388 -222
  9. package/templates/self-improvement-full.md +91 -0
  10. package/templates/{self-improvement.md → self-improvement-lite.md} +13 -9
  11. package/dist/api/client.d.ts +0 -14
  12. package/dist/api/client.js +0 -67
  13. package/dist/cli/commands/setup-self-improvement-gh.d.ts +0 -7
  14. package/dist/cli/commands/setup-self-improvement-gh.js +0 -310
  15. package/dist/cli/commands/setup.d.ts +0 -7
  16. package/dist/cli/commands/setup.js +0 -173
  17. package/dist/cli/commands/skill.d.ts +0 -24
  18. package/dist/cli/commands/skill.js +0 -264
  19. package/dist/cli/utils/ide-config.d.ts +0 -31
  20. package/dist/cli/utils/ide-config.js +0 -294
  21. package/dist/cli/utils/prompts.d.ts +0 -22
  22. package/dist/cli/utils/prompts.js +0 -71
  23. package/dist/tools/analyzeFlow.d.ts +0 -7
  24. package/dist/tools/analyzeFlow.js +0 -68
  25. package/dist/tools/analyzeFunnel.d.ts +0 -7
  26. package/dist/tools/analyzeFunnel.js +0 -63
  27. package/dist/tools/catalog/callTool.d.ts +0 -22
  28. package/dist/tools/catalog/callTool.js +0 -92
  29. package/dist/tools/catalog/index.d.ts +0 -11
  30. package/dist/tools/catalog/index.js +0 -11
  31. package/dist/tools/catalog/searchTools.d.ts +0 -22
  32. package/dist/tools/catalog/searchTools.js +0 -194
  33. package/dist/tools/compareCohorts.d.ts +0 -6
  34. package/dist/tools/compareCohorts.js +0 -84
  35. package/dist/tools/comparePeriods.d.ts +0 -6
  36. package/dist/tools/comparePeriods.js +0 -54
  37. package/dist/tools/detectDrift.d.ts +0 -6
  38. package/dist/tools/detectDrift.js +0 -55
  39. package/dist/tools/detectRegressions.d.ts +0 -6
  40. package/dist/tools/detectRegressions.js +0 -63
  41. package/dist/tools/diagnostic.d.ts +0 -6
  42. package/dist/tools/diagnostic.js +0 -109
  43. package/dist/tools/discoverPersonas.d.ts +0 -6
  44. package/dist/tools/discoverPersonas.js +0 -50
  45. package/dist/tools/getActionableIssues.d.ts +0 -7
  46. package/dist/tools/getActionableIssues.js +0 -55
  47. package/dist/tools/getAnomalies.d.ts +0 -6
  48. package/dist/tools/getAnomalies.js +0 -53
  49. package/dist/tools/getConsoleErrors.d.ts +0 -6
  50. package/dist/tools/getConsoleErrors.js +0 -61
  51. package/dist/tools/getDeadClicks.d.ts +0 -6
  52. package/dist/tools/getDeadClicks.js +0 -42
  53. package/dist/tools/getDomains.d.ts +0 -6
  54. package/dist/tools/getDomains.js +0 -34
  55. package/dist/tools/getElementFriction.d.ts +0 -6
  56. package/dist/tools/getElementFriction.js +0 -45
  57. package/dist/tools/getFlowFriction.d.ts +0 -7
  58. package/dist/tools/getFlowFriction.js +0 -57
  59. package/dist/tools/getFormFriction.d.ts +0 -6
  60. package/dist/tools/getFormFriction.js +0 -42
  61. package/dist/tools/getIssues.d.ts +0 -6
  62. package/dist/tools/getIssues.js +0 -82
  63. package/dist/tools/getJourneyPatterns.d.ts +0 -7
  64. package/dist/tools/getJourneyPatterns.js +0 -50
  65. package/dist/tools/getPageMetrics.d.ts +0 -6
  66. package/dist/tools/getPageMetrics.js +0 -47
  67. package/dist/tools/getPageTrends.d.ts +0 -6
  68. package/dist/tools/getPageTrends.js +0 -46
  69. package/dist/tools/getSessionDetails.d.ts +0 -6
  70. package/dist/tools/getSessionDetails.js +0 -70
  71. package/dist/tools/getSessionPages.d.ts +0 -7
  72. package/dist/tools/getSessionPages.js +0 -74
  73. package/dist/tools/getUxHealthReport.d.ts +0 -7
  74. package/dist/tools/getUxHealthReport.js +0 -50
  75. package/dist/tools/improvementRun.d.ts +0 -6
  76. package/dist/tools/improvementRun.js +0 -315
  77. package/dist/tools/knowledge.d.ts +0 -6
  78. package/dist/tools/knowledge.js +0 -186
  79. package/dist/tools/listPages.d.ts +0 -6
  80. package/dist/tools/listPages.js +0 -50
  81. package/dist/tools/listSessions.d.ts +0 -7
  82. package/dist/tools/listSessions.js +0 -67
  83. package/dist/tools/memory.d.ts +0 -7
  84. package/dist/tools/memory.js +0 -119
  85. package/dist/tools/predictOutcomes.d.ts +0 -6
  86. package/dist/tools/predictOutcomes.js +0 -66
  87. package/dist/tools/remediation.d.ts +0 -6
  88. package/dist/tools/remediation.js +0 -223
  89. package/dist/tools/scanSite.d.ts +0 -6
  90. package/dist/tools/scanSite.js +0 -51
  91. package/dist/tools/searchSessions.d.ts +0 -6
  92. package/dist/tools/searchSessions.js +0 -51
  93. package/dist/tools/triage.d.ts +0 -6
  94. package/dist/tools/triage.js +0 -114
  95. package/dist/tools/triageSessions.d.ts +0 -8
  96. package/dist/tools/triageSessions.js +0 -197
  97. package/dist/tools/upgradeOptions.d.ts +0 -7
  98. package/dist/tools/upgradeOptions.js +0 -67
@@ -1,47 +0,0 @@
1
- /**
2
- * get_page_metrics tool
3
- *
4
- * Returns aggregated behavioral metrics for a specific page or 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 registerGetPageMetrics(server) {
10
- server.registerTool("get_page_metrics", {
11
- description: "Get aggregated behavioral metrics for a page. Returns frustration, confusion, confidence, energy scores, and health score. If page_path is omitted, returns metrics for all pages.",
12
- inputSchema: z.object({
13
- page_path: z
14
- .string()
15
- .optional()
16
- .describe("Page path to get metrics for (e.g., /checkout). Omit to get all pages."),
17
- days: z
18
- .number()
19
- .optional()
20
- .default(7)
21
- .describe("Number of days to look back (default: 7)"),
22
- }),
23
- }, async ({ page_path, days }) => {
24
- if (!isApiConfigured()) {
25
- return {
26
- content: [
27
- {
28
- type: "text",
29
- text: JSON.stringify({ error: "API not configured" }),
30
- },
31
- ],
32
- isError: true,
33
- };
34
- }
35
- const { data, error } = await apiGet("/pages", {
36
- page_path,
37
- days,
38
- });
39
- if (error) {
40
- return {
41
- content: [{ type: "text", text: JSON.stringify({ error }) }],
42
- isError: true,
43
- };
44
- }
45
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
46
- });
47
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * get_page_trends tool
3
- *
4
- * Returns daily behavioral trends for a page.
5
- */
6
- export declare function registerGetPageTrends(server: any): void;
@@ -1,46 +0,0 @@
1
- /**
2
- * get_page_trends tool
3
- *
4
- * Returns daily behavioral trends for a page.
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 registerGetPageTrends(server) {
10
- server.registerTool("get_page_trends", {
11
- description: "Get daily behavioral trends for a page. Shows how frustration, confusion, and confidence change over time.",
12
- inputSchema: z.object({
13
- page_path: z
14
- .string()
15
- .describe("Page path to analyze (e.g., /checkout)"),
16
- days: z
17
- .number()
18
- .optional()
19
- .default(14)
20
- .describe("Number of days to look back (default: 14)"),
21
- }),
22
- }, async ({ page_path, days }) => {
23
- if (!isApiConfigured()) {
24
- return {
25
- content: [
26
- {
27
- type: "text",
28
- text: JSON.stringify({ error: "API not configured" }),
29
- },
30
- ],
31
- isError: true,
32
- };
33
- }
34
- const { data, error } = await apiGet("/trends", {
35
- page_path,
36
- days: days ?? 14,
37
- });
38
- if (error) {
39
- return {
40
- content: [{ type: "text", text: JSON.stringify({ error }) }],
41
- isError: true,
42
- };
43
- }
44
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
45
- });
46
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * get_session_details tool
3
- *
4
- * Returns behavioral timeline for one or more sessions.
5
- */
6
- export declare function registerGetSessionDetails(server: any): void;
@@ -1,70 +0,0 @@
1
- /**
2
- * get_session_details tool
3
- *
4
- * Returns behavioral timeline for one or more sessions.
5
- */
6
- import { z } from "zod";
7
- import { apiGet, apiPost, isApiConfigured } from "../api/client.js";
8
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
- export function registerGetSessionDetails(server) {
10
- server.registerTool("get_session_details", {
11
- description: "Get behavioral timeline for one or more sessions. Shows how frustration, confusion, and confidence evolved over time. Accepts a single session_id or an array of session_ids (max 20).",
12
- inputSchema: z.object({
13
- session_id: z
14
- .string()
15
- .optional()
16
- .describe("Single session ID to get details for"),
17
- session_ids: z
18
- .array(z.string())
19
- .max(20)
20
- .optional()
21
- .describe("Array of session IDs to get details for (max 20)"),
22
- }),
23
- }, async ({ session_id, session_ids, }) => {
24
- if (!isApiConfigured()) {
25
- return {
26
- content: [
27
- {
28
- type: "text",
29
- text: JSON.stringify({ error: "API not configured" }),
30
- },
31
- ],
32
- isError: true,
33
- };
34
- }
35
- if (!session_id && (!session_ids || session_ids.length === 0)) {
36
- return {
37
- content: [
38
- {
39
- type: "text",
40
- text: JSON.stringify({
41
- error: "Either session_id or session_ids must be provided",
42
- }),
43
- },
44
- ],
45
- isError: true,
46
- };
47
- }
48
- if (session_id && !session_ids) {
49
- const { data, error } = await apiGet(`/sessions/${session_id}`);
50
- if (error) {
51
- return {
52
- content: [{ type: "text", text: JSON.stringify({ error }) }],
53
- isError: true,
54
- };
55
- }
56
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
57
- }
58
- const ids = session_ids ?? [session_id];
59
- const { data, error } = await apiPost("/sessions/details", {
60
- session_ids: ids,
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
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * get_session_pages tool
3
- *
4
- * Returns the pages visited within one or more sessions.
5
- * Thin proxy to external-api /sessions/:id/pages and /sessions/pages endpoints.
6
- */
7
- export declare function registerGetSessionPages(server: any): void;
@@ -1,74 +0,0 @@
1
- /**
2
- * get_session_pages tool
3
- *
4
- * Returns the pages visited within one or more sessions.
5
- * Thin proxy to external-api /sessions/:id/pages and /sessions/pages endpoints.
6
- */
7
- import { z } from "zod";
8
- import { apiGet, apiPost, isApiConfigured } from "../api/client.js";
9
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
- export function registerGetSessionPages(server) {
11
- server.registerTool("get_session_pages", {
12
- description: "Get the pages visited within one or more sessions. Returns navigation history " +
13
- "with timestamps, source pages, and dwell times. Use this to understand the " +
14
- "user's journey through the site during a session. Accepts a single session_id " +
15
- "or an array of session_ids (max 20).",
16
- inputSchema: z.object({
17
- session_id: z
18
- .string()
19
- .optional()
20
- .describe("Single session ID to get pages for"),
21
- session_ids: z
22
- .array(z.string())
23
- .max(20)
24
- .optional()
25
- .describe("Array of session IDs to get pages for (max 20)"),
26
- }),
27
- }, async ({ session_id, session_ids, }) => {
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
- if (!session_id && (!session_ids || session_ids.length === 0)) {
40
- return {
41
- content: [
42
- {
43
- type: "text",
44
- text: JSON.stringify({
45
- error: "Either session_id or session_ids must be provided",
46
- }),
47
- },
48
- ],
49
- isError: true,
50
- };
51
- }
52
- if (session_id && !session_ids) {
53
- const { data, error } = await apiGet(`/sessions/${session_id}/pages`);
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
- const ids = session_ids ?? [session_id];
63
- const { data, error } = await apiPost("/sessions/pages", {
64
- session_ids: ids,
65
- });
66
- if (error) {
67
- return {
68
- content: [{ type: "text", text: JSON.stringify({ error }) }],
69
- isError: true,
70
- };
71
- }
72
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
73
- });
74
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * get_ux_health_report tool
3
- *
4
- * Returns a comprehensive UX health report for the website or a specific page.
5
- * Thin proxy to external-api /health-report endpoint.
6
- */
7
- export declare function registerGetUxHealthReport(server: any): void;
@@ -1,50 +0,0 @@
1
- /**
2
- * get_ux_health_report tool
3
- *
4
- * Returns a comprehensive UX health report for the website or a specific page.
5
- * Thin proxy to external-api /health-report 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 registerGetUxHealthReport(server) {
11
- server.registerTool("get_ux_health_report", {
12
- description: "Get a comprehensive UX health report combining page metrics, issues, and anomalies. " +
13
- "Returns overall health score, per-page breakdown, active issues, and frustration spikes. " +
14
- "Use this as a starting point to understand overall UX state before diving deeper.",
15
- inputSchema: z.object({
16
- page_path: z
17
- .string()
18
- .optional()
19
- .describe("Focus on a specific page (omit for site-wide report)"),
20
- days: z
21
- .number()
22
- .optional()
23
- .default(7)
24
- .describe("Number of days to analyze (default: 7)"),
25
- }),
26
- }, async ({ page_path, days }) => {
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("/health-report", {
39
- page_path,
40
- days: days ?? 7,
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,6 +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
- export declare function registerImprovementRunTools(server: any): void;
@@ -1,315 +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
- phases: z
64
- .array(z.object({
65
- name: z.string(),
66
- status: z.enum([
67
- "pending",
68
- "running",
69
- "completed",
70
- "skipped",
71
- "failed",
72
- ]),
73
- startedAt: z.string().nullable().optional(),
74
- completedAt: z.string().nullable().optional(),
75
- output: z.record(z.unknown()).optional(),
76
- }))
77
- .optional()
78
- .describe("Updated phases array"),
79
- summary: z
80
- .object({
81
- issuesFound: z.number().optional(),
82
- issuesFixed: z.number().optional(),
83
- issuesDeferred: z.number().optional(),
84
- issuesDismissed: z.number().optional(),
85
- prsCreated: z.number().optional(),
86
- })
87
- .optional()
88
- .describe("Updated summary counts"),
89
- completed_at: z
90
- .string()
91
- .optional()
92
- .describe("ISO timestamp when the run completed"),
93
- duration_ms: z
94
- .number()
95
- .optional()
96
- .describe("Total duration of the run in milliseconds"),
97
- }),
98
- }, async ({ run_id, status, phases, summary, completed_at, duration_ms, }) => {
99
- if (!isApiConfigured()) {
100
- return {
101
- content: [
102
- {
103
- type: "text",
104
- text: JSON.stringify({ error: "API not configured" }),
105
- },
106
- ],
107
- isError: true,
108
- };
109
- }
110
- const { data, error } = await apiPatch(`/improvement-runs/${run_id}`, {
111
- status,
112
- phases,
113
- summary,
114
- completed_at,
115
- duration_ms,
116
- });
117
- if (error) {
118
- return {
119
- content: [{ type: "text", text: JSON.stringify({ error }) }],
120
- isError: true,
121
- };
122
- }
123
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
124
- });
125
- server.registerTool("record_improvement_action", {
126
- description: "Record an action taken during an improvement run. Use to track what was done for each issue: code fixes, deferrals, dismissals, etc. " +
127
- "IMPORTANT: When recording code_fix actions, the code_changes.diff field must contain ACTUAL SOURCE CODE in unified diff format, " +
128
- "not a description of what changed. Include the literal code lines with proper +/- prefixes.",
129
- inputSchema: z.object({
130
- run_id: z.string().describe("The ID of the improvement run"),
131
- issue_id: z
132
- .string()
133
- .optional()
134
- .describe("The ID of the issue this action relates to (if any)"),
135
- action_type: z
136
- .enum([
137
- "code_fix",
138
- "needs_more_data",
139
- "dismissed",
140
- "marked_intended",
141
- "knowledge_added",
142
- ])
143
- .describe("Type of action taken"),
144
- hypothesis: z.string().describe("AI's reasoning for this action"),
145
- expected_improvement: z
146
- .string()
147
- .describe("What improvement is expected from this action"),
148
- code_changes: z
149
- .array(z.object({
150
- file: z.string().describe("Path to the changed file"),
151
- diff: z
152
- .string()
153
- .describe("CRITICAL: Must be actual source code in unified diff format, NOT a description of changes. " +
154
- "This field must contain the literal code lines that were changed.\n\n" +
155
- "FORMAT REQUIREMENTS:\n" +
156
- "1. Start with @@ header: @@ -oldStart,oldCount +newStart,newCount @@\n" +
157
- "2. Context lines (unchanged): prefix with single space ' '\n" +
158
- "3. Removed lines: prefix with minus '-'\n" +
159
- "4. Added lines: prefix with plus '+'\n" +
160
- "5. Include 5 lines of context before and after the change\n\n" +
161
- "CORRECT EXAMPLE:\n" +
162
- "@@ -35,7 +35,9 @@\n" +
163
- " import { Spinner } from '@chakra-ui/react';\n" +
164
- " \n" +
165
- " export function FilterDropdown({ filters }) {\n" +
166
- "- const [isOpen, setIsOpen] = useState(false);\n" +
167
- "+ const [isOpen, setIsOpen] = useState(false);\n" +
168
- "+ const [isLoading, setIsLoading] = useState(false);\n" +
169
- " const handleClick = () => {\n" +
170
- " \n\n" +
171
- "WRONG (do NOT do this):\n" +
172
- "- 'Added isLoading state to provide feedback'\n" +
173
- "- 'Changed the button to show a spinner'\n" +
174
- "- Any prose description instead of actual code"),
175
- startLine: z
176
- .number()
177
- .describe("Line number in the original file where the first line of the diff begins (the first context line)"),
178
- linesAdded: z
179
- .number()
180
- .default(0)
181
- .describe("Count of lines added (lines starting with '+')"),
182
- linesRemoved: z
183
- .number()
184
- .default(0)
185
- .describe("Count of lines removed (lines starting with '-')"),
186
- }))
187
- .optional()
188
- .describe("Array of code changes. Each diff MUST contain actual source code lines, not descriptions."),
189
- pr_url: z
190
- .string()
191
- .optional()
192
- .describe("GitHub PR URL if a PR was created"),
193
- pr_number: z.number().optional().describe("GitHub PR number"),
194
- remediation_id: z
195
- .string()
196
- .optional()
197
- .describe("ID of the associated remediation record (if any)"),
198
- deferral_reason: z
199
- .string()
200
- .optional()
201
- .describe("Explanation for why the issue was deferred (for needs_more_data actions)"),
202
- dismissal_reason: z
203
- .string()
204
- .optional()
205
- .describe("Explanation for why the issue was dismissed (for dismissed/marked_intended actions)"),
206
- }),
207
- }, async ({ run_id, issue_id, action_type, hypothesis, expected_improvement, code_changes, pr_url, pr_number, remediation_id, deferral_reason, dismissal_reason, }) => {
208
- if (!isApiConfigured()) {
209
- return {
210
- content: [
211
- {
212
- type: "text",
213
- text: JSON.stringify({ error: "API not configured" }),
214
- },
215
- ],
216
- isError: true,
217
- };
218
- }
219
- const { data, error } = await apiPost(`/improvement-runs/${run_id}/actions`, {
220
- issue_id,
221
- action_type,
222
- hypothesis,
223
- expected_improvement,
224
- code_changes,
225
- pr_url,
226
- pr_number,
227
- remediation_id,
228
- deferral_reason,
229
- dismissal_reason,
230
- });
231
- if (error) {
232
- return {
233
- content: [{ type: "text", text: JSON.stringify({ error }) }],
234
- isError: true,
235
- };
236
- }
237
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
238
- });
239
- server.registerTool("get_improvement_run", {
240
- description: "Get details of a specific improvement run including all actions taken. Use to review what happened during a run.",
241
- inputSchema: z.object({
242
- run_id: z
243
- .string()
244
- .describe("The ID of the improvement run to retrieve"),
245
- }),
246
- }, async ({ run_id }) => {
247
- if (!isApiConfigured()) {
248
- return {
249
- content: [
250
- {
251
- type: "text",
252
- text: JSON.stringify({ error: "API not configured" }),
253
- },
254
- ],
255
- isError: true,
256
- };
257
- }
258
- const { data, error } = await apiGet(`/improvement-runs/${run_id}`);
259
- if (error) {
260
- return {
261
- content: [{ type: "text", text: JSON.stringify({ error }) }],
262
- isError: true,
263
- };
264
- }
265
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
266
- });
267
- server.registerTool("list_improvement_runs", {
268
- description: "List recent improvement runs with optional filters. Use to review past runs and their outcomes.",
269
- inputSchema: z.object({
270
- status: z
271
- .enum(["running", "completed", "failed", "cancelled"])
272
- .optional()
273
- .describe("Filter by run status"),
274
- trigger_type: z
275
- .enum(["github_actions", "cron", "manual", "api"])
276
- .optional()
277
- .describe("Filter by trigger type"),
278
- limit: z
279
- .number()
280
- .optional()
281
- .default(20)
282
- .describe("Maximum number of results (default: 20)"),
283
- offset: z
284
- .number()
285
- .optional()
286
- .default(0)
287
- .describe("Offset for pagination"),
288
- }),
289
- }, async ({ status, trigger_type, limit, offset, }) => {
290
- if (!isApiConfigured()) {
291
- return {
292
- content: [
293
- {
294
- type: "text",
295
- text: JSON.stringify({ error: "API not configured" }),
296
- },
297
- ],
298
- isError: true,
299
- };
300
- }
301
- const { data, error } = await apiGet("/improvement-runs", {
302
- status,
303
- trigger_type,
304
- limit: limit ?? 20,
305
- offset: offset ?? 0,
306
- });
307
- if (error) {
308
- return {
309
- content: [{ type: "text", text: JSON.stringify({ error }) }],
310
- isError: true,
311
- };
312
- }
313
- return { content: [{ type: "text", text: JSON.stringify(data) }] };
314
- });
315
- }
@@ -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;