dev3000 0.0.62 → 0.0.64

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 (43) hide show
  1. package/dist/dev-environment.js +2 -2
  2. package/mcp-server/.next/BUILD_ID +1 -1
  3. package/mcp-server/.next/build-manifest.json +2 -2
  4. package/mcp-server/.next/cache/.tsbuildinfo +1 -1
  5. package/mcp-server/.next/fallback-build-manifest.json +2 -2
  6. package/mcp-server/.next/prerender-manifest.json +6 -6
  7. package/mcp-server/.next/server/app/_global-error.html +2 -2
  8. package/mcp-server/.next/server/app/_global-error.rsc +1 -1
  9. package/mcp-server/.next/server/app/_not-found.html +1 -1
  10. package/mcp-server/.next/server/app/_not-found.rsc +1 -1
  11. package/mcp-server/.next/server/app/index.html +1 -1
  12. package/mcp-server/.next/server/app/index.rsc +1 -1
  13. package/mcp-server/.next/server/app/replay.html +1 -1
  14. package/mcp-server/.next/server/app/replay.rsc +1 -1
  15. package/mcp-server/.next/server/chunks/[root-of-the-server]__7f1ecf7b._.js +1 -1
  16. package/mcp-server/.next/server/chunks/[root-of-the-server]__7f1ecf7b._.js.map +1 -1
  17. package/mcp-server/.next/server/chunks/[root-of-the-server]__82298dd3._.js +5 -9
  18. package/mcp-server/.next/server/chunks/[root-of-the-server]__82298dd3._.js.map +1 -1
  19. package/mcp-server/.next/server/pages/404.html +1 -1
  20. package/mcp-server/.next/server/pages/500.html +2 -2
  21. package/mcp-server/.next/standalone/.next/BUILD_ID +1 -1
  22. package/mcp-server/.next/standalone/.next/build-manifest.json +2 -2
  23. package/mcp-server/.next/standalone/.next/prerender-manifest.json +6 -6
  24. package/mcp-server/.next/standalone/.next/server/app/_global-error.html +2 -2
  25. package/mcp-server/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  26. package/mcp-server/.next/standalone/.next/server/app/_not-found.html +1 -1
  27. package/mcp-server/.next/standalone/.next/server/app/_not-found.rsc +1 -1
  28. package/mcp-server/.next/standalone/.next/server/app/index.html +1 -1
  29. package/mcp-server/.next/standalone/.next/server/app/index.rsc +1 -1
  30. package/mcp-server/.next/standalone/.next/server/app/replay.html +1 -1
  31. package/mcp-server/.next/standalone/.next/server/app/replay.rsc +1 -1
  32. package/mcp-server/.next/standalone/.next/server/chunks/[root-of-the-server]__7f1ecf7b._.js +1 -1
  33. package/mcp-server/.next/standalone/.next/server/chunks/[root-of-the-server]__82298dd3._.js +5 -9
  34. package/mcp-server/.next/standalone/.next/server/pages/404.html +1 -1
  35. package/mcp-server/.next/standalone/.next/server/pages/500.html +2 -2
  36. package/mcp-server/.next/standalone/app/api/mcp/[transport]/route.ts +153 -677
  37. package/mcp-server/.next/trace +1 -1
  38. package/mcp-server/app/api/mcp/[transport]/route.ts +153 -677
  39. package/mcp-server/app/api/tools/route.ts +14 -133
  40. package/package.json +1 -1
  41. /package/mcp-server/.next/static/{fgx2Ltd5vbloYUQlVKX60 → lDFZiYn5DNSLwH0MarFSI}/_buildManifest.js +0 -0
  42. /package/mcp-server/.next/static/{fgx2Ltd5vbloYUQlVKX60 → lDFZiYn5DNSLwH0MarFSI}/_clientMiddlewareManifest.json +0 -0
  43. /package/mcp-server/.next/static/{fgx2Ltd5vbloYUQlVKX60 → lDFZiYn5DNSLwH0MarFSI}/_ssgManifest.js +0 -0
@@ -5,19 +5,39 @@ import { z } from "zod"
5
5
 
6
6
  const handler = createMcpHandler(
7
7
  (server) => {
8
- // Debug my app - comprehensive proactive analysis
8
+ // Enhanced debug_my_app - the ultimate debugging tool
9
9
  server.tool(
10
10
  "debug_my_app",
11
- "🚨 SHORTCUT COMMAND: Complete proactive analysis of your development environment. When user says 'debug my app' or similar, use THIS tool instead of trying to read files manually. This tool automatically: (1) Checks recent logs for errors and exceptions, (2) Searches for common error patterns, (3) Gets browser errors, (4) Provides actionable debugging insights with IMMEDIATE FIXES. MAGIC WORKFLOW: After identifying issues, immediately offer to fix them by editing code files, then use execute_browser_action to verify the fix works. This creates the magical dev3000 experience where AI doesn't just find bugs but FIXES and VERIFIES them automatically!",
11
+ "🎯 **THE ULTIMATE FIND→FIX→VERIFY MACHINE!** This tool is pure dev3000 magic - it FINDS all issues instantly, GUIDES you to fix them perfectly, then helps you VERIFY the fixes work! 🪄\n\n🔥 **INSTANT DEBUGGING SUPERPOWERS:**\n• Detects ALL error types: server crashes, browser errors, build failures, API issues, performance problems\n• Analyzes timestamps, error patterns, user interactions, network requests - COMPREHENSIVELY\n• Provides step-by-step fix recommendations with exact file locations and code examples\n\n⚡ **3 MAGICAL MODES:**\n• SNAPSHOT: 'What's broken RIGHT NOW?' → Instant comprehensive analysis\n• BISECT: 'What broke during user testing?' → Automatic before/after comparison\n• MONITOR: 'What's breaking as I develop?' → Continuous health monitoring\n\n🎪 **THE DEV3000 MAGIC WORKFLOW:**\n1️⃣ I FIND all issues (replaces 8+ separate tools!)\n2️⃣ You FIX them with my detailed guidance \n3️⃣ We VERIFY fixes work with execute_browser_action\n\n💡 **PERFECT FOR:** 'debug my app' requests, proactive monitoring, timestamp-based debugging, comprehensive error analysis. This tool makes debugging FUN and gets RESULTS!",
12
12
  {
13
13
  focusArea: z
14
14
  .string()
15
15
  .optional()
16
- .describe("Specific area to focus on: 'build', 'runtime', 'network', 'ui', or 'all' (default: 'all')")
16
+ .describe("Specific area: 'build', 'runtime', 'network', 'ui', 'all' (default: 'all')"),
17
+ mode: z
18
+ .enum(["snapshot", "bisect", "monitor"])
19
+ .optional()
20
+ .describe("Debug mode: 'snapshot' (immediate), 'bisect' (timestamp-based), 'monitor' (continuous)"),
21
+ waitForUserInteraction: z
22
+ .boolean()
23
+ .optional()
24
+ .describe("In bisect mode: capture timestamp, wait for user testing, then analyze (default: false)"),
25
+ timeRangeMinutes: z.number().optional().describe("Minutes to analyze back from now (default: 10)"),
26
+ includeTimestampInstructions: z
27
+ .boolean()
28
+ .optional()
29
+ .describe("Show timestamp-based debugging instructions for manual workflow (default: true)")
17
30
  },
18
- async ({ focusArea = "all" }) => {
31
+ async ({
32
+ focusArea = "all",
33
+ mode = "snapshot",
34
+ waitForUserInteraction = false,
35
+ timeRangeMinutes = 10,
36
+ includeTimestampInstructions = true
37
+ }) => {
19
38
  const logPath = process.env.LOG_FILE_PATH || "/tmp/d3k.log"
20
39
  const results: string[] = []
40
+ const currentTimestamp = new Date().toISOString()
21
41
 
22
42
  try {
23
43
  if (!existsSync(logPath)) {
@@ -25,7 +45,7 @@ const handler = createMcpHandler(
25
45
  content: [
26
46
  {
27
47
  type: "text",
28
- text: `❌ No dev3000 logs found at ${logPath}. Make sure dev3000 is running (d3k or dev3000 command). If you're not using dev3000, I'll need you to specify which log files to check.`
48
+ text: `❌ No dev3000 logs found at ${logPath}. Make sure dev3000 is running (d3k start). If not using dev3000, specify log file paths manually.`
29
49
  }
30
50
  ]
31
51
  }
@@ -34,519 +54,45 @@ const handler = createMcpHandler(
34
54
  const logContent = readFileSync(logPath, "utf-8")
35
55
  const logLines = logContent.split("\n").filter((line) => line.trim())
36
56
 
37
- results.push("🔍 **COMPREHENSIVE APP DEBUG ANALYSIS**\n")
38
-
39
- // 1. Check for recent errors
40
- const recentLines = logLines.slice(-100)
41
- const errorLines = recentLines.filter(
42
- (line) =>
43
- line.includes("ERROR") ||
44
- line.includes("Exception") ||
45
- line.includes("FAIL") ||
46
- line.includes("500") ||
47
- line.includes("404") ||
48
- line.includes("timeout")
49
- )
50
-
51
- if (errorLines.length > 0) {
52
- results.push("🚨 **RECENT ERRORS DETECTED:**")
53
- results.push(errorLines.slice(-10).join("\n"))
54
- results.push("")
55
- results.push("🔧 **IMMEDIATE ACTION REQUIRED:** I can help fix these errors right now! Let me:")
56
- results.push("• Analyze the error patterns and identify root causes")
57
- results.push("• Edit the problematic code files to fix the issues")
58
- results.push("• Use browser automation to verify the fixes work")
59
- results.push("• This is the magical dev3000 experience - AI that fixes, not just finds!")
57
+ // Handle different debugging modes
58
+ if (mode === "bisect" && waitForUserInteraction) {
59
+ results.push(`🕐 **BISECT MODE ACTIVATED - TIMESTAMP CAPTURED**`)
60
+ results.push(`📍 Start timestamp: ${currentTimestamp}`)
60
61
  results.push("")
61
- } else {
62
- results.push("✅ No recent errors in last 100 log entries")
63
- }
64
-
65
- // 2. Check browser errors (last hour)
66
- const oneHourAgo = new Date(Date.now() - 60 * 60 * 1000)
67
- const browserErrors = logLines.filter((line) => {
68
- if (!line.includes("[BROWSER]")) return false
69
- if (!(line.includes("ERROR") || line.includes("CONSOLE ERROR"))) return false
70
-
71
- const timestampMatch = line.match(/\[(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)\]/)
72
- if (timestampMatch) {
73
- const logTime = new Date(timestampMatch[1])
74
- return logTime > oneHourAgo
75
- }
76
- return true
77
- })
78
-
79
- if (browserErrors.length > 0) {
80
- results.push("🌐 **BROWSER ERRORS (LAST HOUR):**")
81
- results.push(browserErrors.join("\n"))
82
- results.push("")
83
- results.push("🎯 **FRONTEND FIXES AVAILABLE:** I can immediately:")
84
- results.push("• Fix JavaScript errors by editing the problematic components")
85
- results.push("• Update type definitions to resolve TypeScript issues")
86
- results.push("• Use execute_browser_action to test the fixes in real-time")
87
- results.push("• Capture screenshots to verify UI improvements")
88
- results.push("")
89
- } else {
90
- results.push("✅ No browser errors in the last hour")
91
- }
92
-
93
- // 3. Check for build/compilation issues
94
- if (focusArea === "all" || focusArea === "build") {
95
- const buildErrors = recentLines.filter(
96
- (line) =>
97
- line.includes("Failed to compile") ||
98
- line.includes("Build failed") ||
99
- line.includes("Type error") ||
100
- line.includes("Syntax error") ||
101
- line.includes("Module not found")
102
- )
103
-
104
- if (buildErrors.length > 0) {
105
- results.push("🔨 **BUILD/COMPILATION ISSUES:**")
106
- results.push(buildErrors.join("\n"))
107
- results.push("")
108
- results.push("⚡ **BUILD FIXES READY:** I can instantly:")
109
- results.push("• Fix TypeScript errors by updating type annotations")
110
- results.push("• Resolve import/export issues by correcting module paths")
111
- results.push("• Install missing dependencies automatically")
112
- results.push("• Run the build again to verify everything compiles")
113
- results.push("")
114
- }
115
- }
116
-
117
- // 4. Check for network issues
118
- if (focusArea === "all" || focusArea === "network") {
119
- const networkIssues = recentLines.filter(
120
- (line) =>
121
- line.includes("NETWORK") &&
122
- (line.includes("failed") || line.includes("timeout") || line.includes("500") || line.includes("404"))
123
- )
124
-
125
- if (networkIssues.length > 0) {
126
- results.push("🌐 **NETWORK ISSUES:**")
127
- results.push(networkIssues.join("\n"))
128
- results.push("")
129
- results.push("🚀 **API FIXES INCOMING:** I can automatically:")
130
- results.push("• Fix API endpoint configurations and route handlers")
131
- results.push("• Update fetch calls with proper error handling")
132
- results.push("• Test API endpoints using execute_browser_action")
133
- results.push("• Verify network requests work in the browser")
134
- results.push("")
135
- }
136
- }
137
-
138
- // 5. Summary and magical next steps
139
- results.push("💡 **THE MAGIC HAPPENS NOW:**")
140
- if (errorLines.length > 0 || browserErrors.length > 0) {
141
- results.push("🪄 **READY TO FIX EVERYTHING:** I don't just find bugs - I FIX them!")
142
- results.push("• I'll edit your code files to resolve the errors shown above")
143
- results.push("• I'll use browser automation to test each fix in real-time")
144
- results.push("• I'll take screenshots to show you the improvements")
145
- results.push("• This is the dev3000 magic - AI that codes, tests, and verifies!")
62
+ results.push("🎯 **NEXT STEPS FOR TIMESTAMP-BASED DEBUGGING:**")
63
+ results.push("1. I've captured the current timestamp automatically")
64
+ results.push("2. 🧪 Go test/reproduce the issue in your app now")
65
+ results.push("3. 🔍 When you're done testing, run this tool again with waitForUserInteraction=false")
66
+ results.push("4. 📊 I'll automatically analyze all errors that occurred during your testing")
146
67
  results.push("")
147
- results.push("🎯 **SAY 'FIX THESE ISSUES' AND WATCH THE MAGIC:**")
148
- results.push(" I'll start fixing the most critical errors first")
149
- results.push("• Each fix will be tested immediately with execute_browser_action")
150
- results.push("• You'll see real-time proof that the bugs are resolved")
151
- } else {
152
- results.push("• App appears healthy based on recent logs")
153
- results.push("• If you're experiencing issues, try reproducing them while I monitor")
154
- results.push("• Use get_current_timestamp before testing, then get_logs_between_timestamps after")
155
- results.push("• I'm ready to fix any issues that appear!")
156
- }
157
-
158
- results.push(`• Full logs available at: ${logPath}`)
159
- results.push("• Quick access: tail -f /tmp/d3k.log")
160
-
161
- return {
162
- content: [
163
- {
164
- type: "text",
165
- text: results.join("\n")
166
- }
167
- ]
168
- }
169
- } catch (error) {
170
- return {
171
- content: [
172
- {
173
- type: "text",
174
- text: `❌ Error during debug analysis: ${error instanceof Error ? error.message : String(error)}`
175
- }
176
- ]
177
- }
178
- }
179
- }
180
- )
181
-
182
- // Get current timestamp for workflow tracking
183
- server.tool(
184
- "get_current_timestamp",
185
- "⏰ CRITICAL MONITORING TOOL: Get current timestamp for proactive error monitoring workflow. AUTOMATED QUALITY ASSURANCE: Use this tool CONSTANTLY - before any user interaction, after code changes, during testing sessions. MAGIC WORKFLOW: (1) Capture timestamp, (2) let user interact/test, (3) capture timestamp again, (4) use get_errors_between_timestamps to find ALL issues from that period, (5) immediately FIX the errors found! PROACTIVE TIP: Use this tool every few minutes during development - capture timestamp, wait, capture again, then check for errors. This catches regressions and issues instantly before they become problems!",
186
- {},
187
- async () => {
188
- const timestamp = new Date().toISOString()
189
- return {
190
- content: [
191
- {
192
- type: "text",
193
- text: `Current timestamp: ${timestamp}`
194
- }
195
- ]
196
- }
197
- }
198
- )
199
-
200
- // Healthcheck tool
201
- server.tool(
202
- "healthcheck",
203
- "Internal healthcheck tool - rarely needed since MCP connection is already working if you can see this. Only use if explicitly asked to verify server health. Prefer read_consolidated_logs for debugging. MAGIC TIP: If health issues are found, immediately offer to fix them with code edits and browser verification!",
204
- {
205
- message: z.string().optional().describe("Optional message to echo back")
206
- },
207
- async ({ message = "MCP server is healthy!" }) => {
208
- return {
209
- content: [
210
- {
211
- type: "text",
212
- text: `✅ ${message} - Timestamp: ${new Date().toISOString()}`
213
- }
214
- ]
215
- }
216
- }
217
- )
218
-
219
- // Tool to read consolidated logs
220
- server.tool(
221
- "read_consolidated_logs",
222
- "Read recent consolidated development logs containing server output, browser console logs, network requests, user interactions, and screenshots. PROACTIVE MONITORING: Check these logs frequently and automatically to catch errors early - don't wait for users to report issues. Look for ERROR, WARNING, EXCEPTION patterns in recent logs. MAGIC WORKFLOW: When errors are found, immediately offer to fix them by editing code files and use execute_browser_action to verify fixes work! Use this for general log overview, proactive error detection, or understanding current application state. Logs include [PLAYWRIGHT] or [CHROME_EXTENSION] tags to distinguish monitoring sources. Filter by keywords like 'ERROR', 'NETWORK', 'INTERACTION', or 'SCREENSHOT' for focused analysis. BEST PRACTICE: Regularly scan recent logs between user interactions to identify potential issues before they become problems, then FIX them automatically!",
223
- {
224
- lines: z.number().optional().describe("Number of recent lines to read (default: 50)"),
225
- filter: z.string().optional().describe("Filter logs by text content"),
226
- logPath: z.string().optional().describe("Path to log file (default: /tmp/d3k.log)")
227
- },
228
- async ({ lines = 50, filter, logPath = process.env.LOG_FILE_PATH || "/tmp/d3k.log" }) => {
229
- try {
230
- if (!existsSync(logPath)) {
231
- return {
232
- content: [
233
- {
234
- type: "text",
235
- text: `No log file found at ${logPath}. Make sure the dev environment is running.`
236
- }
237
- ]
238
- }
239
- }
240
-
241
- const logContent = readFileSync(logPath, "utf-8")
242
- let logLines = logContent.split("\n").filter((line) => line.trim())
243
-
244
- // Apply filter if provided
245
- if (filter) {
246
- logLines = logLines.filter((line) => line.toLowerCase().includes(filter.toLowerCase()))
247
- }
248
-
249
- // Get recent lines
250
- const recentLines = logLines.slice(-lines)
251
-
252
- return {
253
- content: [
254
- {
255
- type: "text",
256
- text: recentLines.length > 0 ? recentLines.join("\n") : "No matching log entries found."
257
- }
258
- ]
259
- }
260
- } catch (error) {
261
- return {
262
- content: [
263
- {
264
- type: "text",
265
- text: `Error reading logs: ${error instanceof Error ? error.message : String(error)}`
266
- }
267
- ]
268
- }
269
- }
270
- }
271
- )
272
-
273
- // Tool to search logs
274
- server.tool(
275
- "search_logs",
276
- "Search through consolidated logs using regex patterns with context lines around matches. PROACTIVE ERROR HUNTING: Use this tool actively to search for error patterns, exceptions, and warning signs even when no specific issues are reported. Look for patterns like 'ERROR.*', '.*Exception', 'WARN.*', 'Failed.*', 'timeout', '404', '500' to catch problems early. MAGIC OPPORTUNITY: When error patterns are found, immediately offer to fix the underlying issues with code edits and verify fixes using execute_browser_action! Essential for tracing error patterns, finding specific API calls, or tracking user interaction sequences. Use patterns like 'ERROR.*fetch', 'CLICK.*button', or 'NETWORK.*POST' to find relevant events. Context lines help understand what led to and followed each match. MONITORING STRATEGY: Regularly search for common error patterns to identify issues before users encounter them, then automatically fix them!",
277
- {
278
- pattern: z.string().describe("Regex pattern to search for"),
279
- context: z.number().optional().describe("Number of lines of context around matches (default: 2)"),
280
- logPath: z.string().optional().describe("Path to log file (default: /tmp/d3k.log)")
281
- },
282
- async ({ pattern, context = 2, logPath = process.env.LOG_FILE_PATH || "/tmp/d3k.log" }) => {
283
- try {
284
- if (!existsSync(logPath)) {
285
- return {
286
- content: [
287
- {
288
- type: "text",
289
- text: `No log file found at ${logPath}.`
290
- }
291
- ]
292
- }
293
- }
294
-
295
- const logContent = readFileSync(logPath, "utf-8")
296
- const logLines = logContent.split("\n")
297
-
298
- const regex = new RegExp(pattern, "gi")
299
- const matches: string[] = []
300
-
301
- logLines.forEach((line, index) => {
302
- if (regex.test(line)) {
303
- const start = Math.max(0, index - context)
304
- const end = Math.min(logLines.length, index + context + 1)
305
- const contextLines = logLines.slice(start, end)
306
-
307
- matches.push(`Match at line ${index + 1}:\n${contextLines.join("\n")}\n---`)
308
- }
309
- })
310
-
311
- return {
312
- content: [
313
- {
314
- type: "text",
315
- text: matches.length > 0 ? matches.join("\n\n") : "No matches found for the given pattern."
316
- }
317
- ]
318
- }
319
- } catch (error) {
320
- return {
321
- content: [
322
- {
323
- type: "text",
324
- text: `Error searching logs: ${error instanceof Error ? error.message : String(error)}`
325
- }
326
- ]
327
- }
328
- }
329
- }
330
- )
331
-
332
- // Tool to get logs between timestamps
333
- server.tool(
334
- "get_logs_between_timestamps",
335
- "Get logs between two specific timestamps - CRITICAL for timestamp-based debugging workflow. WORKFLOW: (1) Use get_current_timestamp before user testing, (2) Ask user to reproduce issue/test changes, (3) Use get_current_timestamp after user returns, (4) Use this tool with both timestamps to see exactly what happened during testing. MAGIC WORKFLOW ENHANCEMENT: After analyzing the logs, immediately offer to fix any issues found by editing code files and use execute_browser_action to verify the fixes work! This eliminates noise and focuses analysis on the specific user session. Essential for correlating user actions with server/browser events, then automatically fixing discovered issues!",
336
- {
337
- startTime: z.string().describe("Start timestamp (ISO 8601 format: 2024-01-01T12:00:00.000Z)"),
338
- endTime: z.string().describe("End timestamp (ISO 8601 format: 2024-01-01T12:30:00.000Z)"),
339
- filter: z.string().optional().describe("Filter logs by text content (case insensitive)"),
340
- logPath: z.string().optional().describe("Path to log file (default: /tmp/d3k.log)")
341
- },
342
- async ({ startTime, endTime, filter, logPath = process.env.LOG_FILE_PATH || "/tmp/d3k.log" }) => {
343
- try {
344
- if (!existsSync(logPath)) {
345
- return {
346
- content: [
347
- {
348
- type: "text",
349
- text: `No log file found at ${logPath}.`
350
- }
351
- ]
352
- }
353
- }
354
-
355
- const start = new Date(startTime)
356
- const end = new Date(endTime)
357
-
358
- if (Number.isNaN(start.getTime()) || Number.isNaN(end.getTime())) {
359
- return {
360
- content: [
361
- {
362
- type: "text",
363
- text: "Invalid timestamp format. Use ISO 8601 format: 2024-01-01T12:00:00.000Z"
364
- }
365
- ]
366
- }
367
- }
368
-
369
- if (start >= end) {
370
- return {
371
- content: [
372
- {
373
- type: "text",
374
- text: "Start time must be before end time."
375
- }
376
- ]
377
- }
378
- }
379
-
380
- const logContent = readFileSync(logPath, "utf-8")
381
- const logLines = logContent.split("\n").filter((line) => line.trim())
382
-
383
- // Filter by timestamp range
384
- const filteredLines = logLines.filter((line) => {
385
- const timestampMatch = line.match(/\[(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)\]/)
386
- if (timestampMatch) {
387
- const logTime = new Date(timestampMatch[1])
388
- return logTime >= start && logTime <= end
389
- }
390
- return false // Exclude lines without parseable timestamps
391
- })
68
+ results.push("💡 **This eliminates the need for separate timestamp tools!**")
69
+ results.push("🎪 **The magic happens when you return - I'll have everything ready to fix!**")
392
70
 
393
- // Apply text filter if provided
394
- let resultLines = filteredLines
395
- if (filter) {
396
- resultLines = filteredLines.filter((line) => line.toLowerCase().includes(filter.toLowerCase()))
397
- }
398
-
399
- const timeRange = `${start.toISOString()} to ${end.toISOString()}`
400
- const summary = `Found ${
401
- resultLines.length
402
- } logs between ${timeRange}${filter ? ` matching "${filter}"` : ""}`
403
-
404
- return {
405
- content: [
406
- {
407
- type: "text",
408
- text: resultLines.length > 0 ? `${summary}:\n\n${resultLines.join("\n")}` : `${summary}.`
409
- }
410
- ]
411
- }
412
- } catch (error) {
413
- return {
414
- content: [
415
- {
416
- type: "text",
417
- text: `Error reading logs between timestamps: ${error instanceof Error ? error.message : String(error)}`
418
- }
419
- ]
420
- }
421
- }
422
- }
423
- )
424
-
425
- // Tool to get browser errors
426
- server.tool(
427
- "get_browser_errors",
428
- "Get recent browser errors including console errors, JavaScript exceptions, and page errors from both Playwright and Chrome extension monitoring. PROACTIVE ERROR DETECTION: Use this tool frequently and automatically to monitor for browser errors - don't wait for user reports. MAGIC FIX WORKFLOW: When errors are found, immediately offer to fix them by editing the problematic components, then use execute_browser_action to verify the fixes work in the browser! Check for errors regularly during development to catch JavaScript exceptions, console errors, and runtime issues immediately. Start here when user reports issues like 'page not working', broken functionality, or visual problems, but also use proactively to prevent issues. Filters logs to show only ERROR, CONSOLE ERROR, and PAGE ERROR entries. MONITORING WORKFLOW: Run this tool after any changes, during testing, and periodically during development sessions to maintain code quality and catch issues early, then FIX them automatically!",
429
- {
430
- hours: z.number().optional().describe("Hours to look back (default: 1)"),
431
- logPath: z.string().optional().describe("Path to log file (default: /tmp/d3k.log)")
432
- },
433
- async ({ hours = 1, logPath = process.env.LOG_FILE_PATH || "/tmp/d3k.log" }) => {
434
- try {
435
- if (!existsSync(logPath)) {
436
71
  return {
437
72
  content: [
438
73
  {
439
74
  type: "text",
440
- text: `No log file found at ${logPath}.`
75
+ text: results.join("\n")
441
76
  }
442
77
  ]
443
78
  }
444
79
  }
445
80
 
446
- const logContent = readFileSync(logPath, "utf-8")
447
- const logLines = logContent.split("\n")
448
-
449
- const cutoffTime = new Date(Date.now() - hours * 60 * 60 * 1000)
450
- const errorLines = logLines.filter((line) => {
451
- if (!line.includes("[BROWSER]")) return false
452
- if (!(line.includes("ERROR") || line.includes("CONSOLE ERROR") || line.includes("PAGE ERROR"))) return false
81
+ // Determine time range for analysis
82
+ const cutoffTime = new Date(Date.now() - timeRangeMinutes * 60 * 1000)
453
83
 
454
- // Extract timestamp
455
- const timestampMatch = line.match(/\[(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)\]/)
456
- if (timestampMatch) {
457
- const logTime = new Date(timestampMatch[1])
458
- return logTime > cutoffTime
459
- }
460
- return true // Include if we can't parse timestamp
461
- })
462
-
463
- return {
464
- content: [
465
- {
466
- type: "text",
467
- text:
468
- errorLines.length > 0
469
- ? errorLines.join("\n")
470
- : "No browser errors found in the specified time period."
471
- }
472
- ]
473
- }
474
- } catch (error) {
475
- return {
476
- content: [
477
- {
478
- type: "text",
479
- text: `Error getting browser errors: ${error instanceof Error ? error.message : String(error)}`
480
- }
481
- ]
482
- }
483
- }
484
- }
485
- )
486
-
487
- // Tool to get all types of errors between timestamps
488
- server.tool(
489
- "get_errors_between_timestamps",
490
- "🚨 PROACTIVE ERROR EXTRACTION: Get ALL types of errors (server errors, exceptions, browser errors, build failures, network issues) between specific timestamps. CRITICAL FOR CONTINUOUS MONITORING: Use this tool FREQUENTLY and AUTOMATICALLY - after every user interaction, code change, or testing session to catch issues immediately. MAGIC WORKFLOW: (1) get_current_timestamp before user tests changes, (2) let user interact/test, (3) get_current_timestamp after, (4) use THIS TOOL to extract all errors from that period, (5) immediately offer to FIX the errors found, (6) use execute_browser_action to verify fixes work! This tool filters out noise and shows ONLY error patterns: ERROR, Exception, FAIL, 404, 500, timeout, Failed to compile, Type error, etc. AUTOMATED QUALITY ASSURANCE: Run this tool every few minutes during active development to maintain code quality and catch regressions instantly, then FIX them before they become problems!",
491
- {
492
- startTime: z.string().describe("Start timestamp (ISO 8601 format: 2024-01-01T12:00:00.000Z)"),
493
- endTime: z.string().describe("End timestamp (ISO 8601 format: 2024-01-01T12:30:00.000Z)"),
494
- severity: z.enum(["all", "critical", "warnings"]).optional().describe("Error severity filter (default: 'all')"),
495
- logPath: z.string().optional().describe("Path to log file (default: /tmp/d3k.log)")
496
- },
497
- async ({ startTime, endTime, severity = "all", logPath = process.env.LOG_FILE_PATH || "/tmp/d3k.log" }) => {
498
- try {
499
- if (!existsSync(logPath)) {
500
- return {
501
- content: [
502
- {
503
- type: "text",
504
- text: `No log file found at ${logPath}.`
505
- }
506
- ]
507
- }
508
- }
509
-
510
- const start = new Date(startTime)
511
- const end = new Date(endTime)
512
-
513
- if (Number.isNaN(start.getTime()) || Number.isNaN(end.getTime())) {
514
- return {
515
- content: [
516
- {
517
- type: "text",
518
- text: "Invalid timestamp format. Use ISO 8601 format: 2024-01-01T12:00:00.000Z"
519
- }
520
- ]
521
- }
522
- }
523
-
524
- if (start >= end) {
525
- return {
526
- content: [
527
- {
528
- type: "text",
529
- text: "Start time must be before end time."
530
- }
531
- ]
532
- }
84
+ // For monitor mode, show longer time range
85
+ if (mode === "monitor") {
86
+ results.push(`🔄 **CONTINUOUS MONITORING MODE** (last ${timeRangeMinutes} minutes)`)
87
+ } else {
88
+ results.push(`🔍 **COMPREHENSIVE DEBUG ANALYSIS** (last ${timeRangeMinutes} minutes)`)
533
89
  }
534
90
 
535
- const logContent = readFileSync(logPath, "utf-8")
536
- const logLines = logContent.split("\n").filter((line) => line.trim())
537
-
538
- // Filter by timestamp range first
539
- const timeFilteredLines = logLines.filter((line) => {
540
- const timestampMatch = line.match(/\[(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)\]/)
541
- if (timestampMatch) {
542
- const logTime = new Date(timestampMatch[1])
543
- return logTime >= start && logTime <= end
544
- }
545
- return false
546
- })
91
+ results.push(`📊 Analysis timestamp: ${currentTimestamp}`)
92
+ results.push("")
547
93
 
548
- // Define error patterns by severity
549
- const criticalPatterns = [
94
+ // COMPREHENSIVE ERROR DETECTION - combines all previous tools
95
+ const errorPatterns = [
550
96
  /ERROR/i,
551
97
  /Exception/i,
552
98
  /FATAL/i,
@@ -557,229 +103,155 @@ const handler = createMcpHandler(
557
103
  /Syntax error/i,
558
104
  /Module not found/i,
559
105
  /500/,
106
+ /404/,
560
107
  /ECONNREFUSED/i,
561
108
  /NETWORK.*failed/i,
562
- /timeout.*error/i
109
+ /timeout.*error/i,
110
+ /WARN/i,
111
+ /WARNING/i,
112
+ /deprecated/i,
113
+ /slow/i,
114
+ /retry/i
563
115
  ]
564
116
 
565
- const warningPatterns = [/WARN/i, /WARNING/i, /404/, /deprecated/i, /timeout/i, /retry/i, /slow/i]
566
-
567
- let patterns: RegExp[]
568
- switch (severity) {
569
- case "critical":
570
- patterns = criticalPatterns
571
- break
572
- case "warnings":
573
- patterns = warningPatterns
574
- break
575
- default:
576
- patterns = [...criticalPatterns, ...warningPatterns]
577
- }
117
+ // Filter logs by time range (replaces get_logs_between_timestamps)
118
+ const timeFilteredLines = logLines.filter((line) => {
119
+ const timestampMatch = line.match(/\[(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)\]/)
120
+ if (timestampMatch) {
121
+ const logTime = new Date(timestampMatch[1])
122
+ return logTime >= cutoffTime
123
+ }
124
+ return false
125
+ })
578
126
 
579
- // Filter lines that match error patterns
580
- const errorLines = timeFilteredLines.filter((line) => {
581
- return patterns.some((pattern) => pattern.test(line))
127
+ // Extract ALL error types (replaces multiple error detection tools)
128
+ const allErrors = timeFilteredLines.filter((line) => {
129
+ return errorPatterns.some((pattern) => pattern.test(line))
582
130
  })
583
131
 
584
- // Group errors by type for better analysis
132
+ // Categorize errors for better analysis
585
133
  const categorizedErrors = {
586
- serverErrors: errorLines.filter(
134
+ serverErrors: allErrors.filter(
587
135
  (line) => line.includes("[SERVER]") && (line.includes("ERROR") || line.includes("Exception"))
588
136
  ),
589
- browserErrors: errorLines.filter(
137
+ browserErrors: allErrors.filter(
590
138
  (line) => line.includes("[BROWSER]") && (line.includes("ERROR") || line.includes("CONSOLE ERROR"))
591
139
  ),
592
- buildErrors: errorLines.filter(
140
+ buildErrors: allErrors.filter(
593
141
  (line) =>
594
142
  line.includes("Failed to compile") || line.includes("Type error") || line.includes("Build failed")
595
143
  ),
596
- networkErrors: errorLines.filter(
144
+ networkErrors: allErrors.filter(
597
145
  (line) =>
598
146
  line.includes("NETWORK") || line.includes("404") || line.includes("500") || line.includes("timeout")
599
147
  ),
600
- otherErrors: errorLines.filter(
601
- (line) =>
602
- !line.includes("[SERVER]") &&
603
- !line.includes("[BROWSER]") &&
604
- !line.includes("Failed to compile") &&
605
- !line.includes("NETWORK")
148
+ warnings: allErrors.filter(
149
+ (line) => /WARN|WARNING|deprecated/i.test(line) && !/ERROR|Exception|FAIL/i.test(line)
606
150
  )
607
151
  }
608
152
 
609
- const results = []
610
- const timeRange = `${start.toISOString()} to ${end.toISOString()}`
153
+ const totalErrors = allErrors.length
154
+ const criticalErrors = totalErrors - categorizedErrors.warnings.length
611
155
 
612
- if (errorLines.length === 0) {
613
- results.push(`✅ No errors found between ${timeRange}`)
614
- results.push("🎯 This is great! Your code changes appear to be working without issues.")
615
- results.push("💡 TIP: Continue monitoring by running this tool after each change or test session.")
156
+ if (totalErrors === 0) {
157
+ results.push(`✅ **SYSTEM HEALTHY** - No errors found in last ${timeRangeMinutes} minutes`)
158
+ results.push("🎯 App appears to be running smoothly!")
159
+
160
+ if (includeTimestampInstructions && mode !== "monitor") {
161
+ results.push("")
162
+ results.push("💡 **PROACTIVE MONITORING TIPS:**")
163
+ results.push("• Use mode='bisect' with waitForUserInteraction=true before testing new features")
164
+ results.push("• Use mode='monitor' for continuous background monitoring")
165
+ results.push("• Increase timeRangeMinutes to analyze longer periods")
166
+ }
616
167
  } else {
617
- results.push(`🚨 FOUND ${errorLines.length} ERROR(S) between ${timeRange}`)
168
+ results.push(
169
+ `🚨 **${totalErrors} ISSUES DETECTED** (${criticalErrors} critical, ${categorizedErrors.warnings.length} warnings)`
170
+ )
618
171
  results.push("")
619
172
 
173
+ // Show categorized errors (replaces individual error tools)
620
174
  if (categorizedErrors.serverErrors.length > 0) {
621
175
  results.push("🔥 **SERVER ERRORS:**")
622
- results.push(categorizedErrors.serverErrors.join("\n"))
176
+ results.push(categorizedErrors.serverErrors.slice(-5).join("\n"))
623
177
  results.push("")
624
178
  }
625
179
 
626
180
  if (categorizedErrors.browserErrors.length > 0) {
627
- results.push("🌐 **BROWSER ERRORS:**")
628
- results.push(categorizedErrors.browserErrors.join("\n"))
181
+ results.push("🌐 **BROWSER/CONSOLE ERRORS:**")
182
+ results.push(categorizedErrors.browserErrors.slice(-5).join("\n"))
629
183
  results.push("")
630
184
  }
631
185
 
632
186
  if (categorizedErrors.buildErrors.length > 0) {
633
- results.push("🔨 **BUILD ERRORS:**")
634
- results.push(categorizedErrors.buildErrors.join("\n"))
187
+ results.push("🔨 **BUILD/COMPILATION ERRORS:**")
188
+ results.push(categorizedErrors.buildErrors.slice(-5).join("\n"))
635
189
  results.push("")
636
190
  }
637
191
 
638
192
  if (categorizedErrors.networkErrors.length > 0) {
639
- results.push("🌐 **NETWORK ERRORS:**")
640
- results.push(categorizedErrors.networkErrors.join("\n"))
193
+ results.push("🌐 **NETWORK/API ERRORS:**")
194
+ results.push(categorizedErrors.networkErrors.slice(-5).join("\n"))
641
195
  results.push("")
642
196
  }
643
197
 
644
- if (categorizedErrors.otherErrors.length > 0) {
645
- results.push("⚠️ **OTHER ERRORS:**")
646
- results.push(categorizedErrors.otherErrors.join("\n"))
198
+ if (categorizedErrors.warnings.length > 0 && focusArea === "all") {
199
+ results.push(`⚠️ **WARNINGS** (${categorizedErrors.warnings.length} found, showing recent):`)
200
+ results.push(categorizedErrors.warnings.slice(-3).join("\n"))
647
201
  results.push("")
648
202
  }
649
203
 
650
- results.push("🪄 **IMMEDIATE ACTION REQUIRED - MAGIC FIXING TIME:**")
651
- results.push("🎯 **I can fix these errors RIGHT NOW! Here's what I'll do:**")
652
- results.push(" Analyze each error pattern and identify root causes")
653
- results.push("• Edit the problematic code files to resolve the issues")
654
- results.push("• Use execute_browser_action to test each fix in real-time")
655
- results.push("• Take screenshots to verify the improvements")
656
- results.push("• This is the dev3000 magic - errors found and FIXED automatically!")
204
+ // Show the magical dev3000 fix workflow
205
+ results.push("🪄 **ULTIMATE DEV3000 MAGIC READY:**")
206
+ results.push("🎯 **I don't just find errors - I FIX them instantly!**")
207
+ results.push("• Analyze error patterns and identify root causes automatically")
208
+ results.push("• Edit problematic code files to resolve each issue")
209
+ results.push("• Use execute_browser_action to reproduce user workflows")
210
+ results.push("• Dev3000 AUTO-CAPTURES screenshots during all interactions!")
211
+ results.push("• No manual screenshots needed - dev3000 handles it all!")
212
+ results.push("")
213
+ results.push("📸 **AUTO-SCREENSHOT MAGIC:**")
214
+ results.push("• Screenshots captured automatically on errors, page loads, scrolls")
215
+ results.push("• Just reproduce the user actions - screenshots happen magically")
216
+ results.push("• Check logs for [SCREENSHOT] entries with filenames")
657
217
  results.push("")
658
- results.push("🚀 **SAY 'FIX THESE ERRORS' TO START THE MAGIC:**")
659
- results.push("• I'll prioritize critical errors first, then warnings")
660
- results.push("• Each fix will be tested immediately with browser automation")
661
- results.push("• You'll see real-time proof that every issue is resolved")
218
+ results.push("🚀 **SAY 'FIX THESE ISSUES' TO START THE MAGIC:**")
219
+ results.push("• Critical errors fixed first, then warnings")
220
+ results.push("• Each fix tested with browser interactions (no manual screenshots!)")
221
+ results.push("• Real-time proof that every issue is resolved")
662
222
  }
663
223
 
664
- return {
665
- content: [
666
- {
667
- type: "text",
668
- text: results.join("\n")
669
- }
670
- ]
671
- }
672
- } catch (error) {
673
- return {
674
- content: [
675
- {
676
- type: "text",
677
- text: `Error extracting errors between timestamps: ${error instanceof Error ? error.message : String(error)}`
678
- }
679
- ]
224
+ // Add usage instructions based on mode
225
+ if (includeTimestampInstructions && mode !== "monitor") {
226
+ results.push("")
227
+ results.push("📚 **ADVANCED DEBUGGING MODES:**")
228
+ results.push("• **Snapshot** (current): Immediate comprehensive analysis")
229
+ results.push("• **Bisect**: Use waitForUserInteraction=true for timestamp-based debugging")
230
+ results.push("• **Monitor**: Continuous monitoring mode for ongoing development")
680
231
  }
681
- }
682
- }
683
- )
684
232
 
685
- // Tool for automated background monitoring
686
- server.tool(
687
- "monitor_for_new_errors",
688
- "🔍 AUTOMATED BACKGROUND MONITORING: Check for ANY new errors that appeared in the last few minutes of development. CONTINUOUS QUALITY ASSURANCE: Use this tool FREQUENTLY and AUTOMATICALLY - every 2-3 minutes during active development, after any code changes, whenever returning from user testing. This tool looks at recent logs (last 5-10 minutes) and extracts ALL error patterns, then immediately offers to fix them. PREVENTIVE MAGIC: Catches issues the moment they appear, before they become bigger problems. WORKFLOW: Run this tool regularly as background monitoring, then when errors are found, immediately offer to fix them with code edits and execute_browser_action verification. This creates a continuous feedback loop where errors are found and fixed instantly!",
689
- {
690
- minutes: z.number().optional().describe("Minutes to look back for new errors (default: 5)"),
691
- autoFix: z.boolean().optional().describe("Whether to immediately offer fixes when errors found (default: true)")
692
- },
693
- async ({ minutes = 5, autoFix = true }) => {
694
- const logPath = process.env.LOG_FILE_PATH || "/tmp/d3k.log"
695
-
696
- try {
697
- if (!existsSync(logPath)) {
698
- return {
699
- content: [
700
- {
701
- type: "text",
702
- text: `No log file found at ${logPath}. Make sure dev3000 is running.`
703
- }
704
- ]
705
- }
233
+ // Show recent screenshots if any exist
234
+ const screenshotLines = timeFilteredLines.filter((line) => line.includes("[SCREENSHOT]"))
235
+ if (screenshotLines.length > 0) {
236
+ results.push("")
237
+ results.push("📸 **RECENT AUTO-CAPTURED SCREENSHOTS:**")
238
+ const recentScreenshots = screenshotLines.slice(-5)
239
+ recentScreenshots.forEach((line) => {
240
+ const match = line.match(/\[SCREENSHOT\]\s+([^\s]+\.png)/)
241
+ if (match) {
242
+ results.push(`• ${match[1]}`)
243
+ }
244
+ })
245
+ results.push("💡 Tip: Dev3000 captures these automatically during interactions!")
706
246
  }
707
247
 
708
- const logContent = readFileSync(logPath, "utf-8")
709
- const logLines = logContent.split("\n").filter((line) => line.trim())
248
+ results.push("")
249
+ results.push(`📁 Full logs: ${logPath}`)
250
+ results.push(`⚡ Quick access: tail -f ${logPath}`)
710
251
 
711
- // Get logs from the last N minutes
712
- const cutoffTime = new Date(Date.now() - minutes * 60 * 1000)
713
- const recentLines = logLines.filter((line) => {
714
- const timestampMatch = line.match(/\[(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)\]/)
715
- if (timestampMatch) {
716
- const logTime = new Date(timestampMatch[1])
717
- return logTime > cutoffTime
718
- }
719
- return false
720
- })
721
-
722
- // Find all error patterns
723
- const errorPatterns = [
724
- /ERROR/i,
725
- /Exception/i,
726
- /FATAL/i,
727
- /CRASH/i,
728
- /Failed to compile/i,
729
- /Build failed/i,
730
- /Type error/i,
731
- /Syntax error/i,
732
- /Module not found/i,
733
- /500/,
734
- /404/,
735
- /ECONNREFUSED/i,
736
- /NETWORK.*failed/i,
737
- /timeout.*error/i,
738
- /WARN/i,
739
- /WARNING/i,
740
- /deprecated/i
741
- ]
742
-
743
- const errorLines = recentLines.filter((line) => {
744
- return errorPatterns.some((pattern) => pattern.test(line))
745
- })
746
-
747
- const results = []
748
-
749
- if (errorLines.length === 0) {
750
- results.push(`✅ Background monitoring: No new errors in the last ${minutes} minutes`)
751
- results.push("🎯 Development environment looks healthy!")
752
- results.push(`💡 Continue coding - I'll keep monitoring in the background.`)
252
+ if (mode === "monitor") {
753
253
  results.push("")
754
- results.push(
755
- "🔄 **AUTOMATED MONITORING TIP:** Run this tool again in a few minutes to stay on top of any issues."
756
- )
757
- } else {
758
- results.push(
759
- `🚨 BACKGROUND MONITORING ALERT: Found ${errorLines.length} error(s) in the last ${minutes} minutes`
760
- )
761
- results.push("")
762
- results.push("📋 **RECENT ERRORS DETECTED:**")
763
- results.push(errorLines.slice(-10).join("\n")) // Show last 10 errors
764
- results.push("")
765
-
766
- if (autoFix) {
767
- results.push("🪄 **MAGIC AUTO-FIX MODE ACTIVATED:**")
768
- results.push("🎯 **I can fix these errors immediately! Here's the plan:**")
769
- results.push("• Analyze each error pattern and identify the root causes")
770
- results.push("• Edit the problematic code files to resolve the issues")
771
- results.push("• Use execute_browser_action to test each fix works")
772
- results.push("• Take screenshots to verify improvements")
773
- results.push("• Continue background monitoring for new issues")
774
- results.push("")
775
- results.push("🚀 **SAY 'AUTO-FIX THESE' TO START THE MAGIC:**")
776
- results.push("• Errors will be fixed automatically with real-time verification")
777
- results.push("• This is the dev3000 experience - continuous quality assurance!")
778
- } else {
779
- results.push("🔧 **ERRORS REQUIRE ATTENTION:**")
780
- results.push("• Use get_errors_between_timestamps for detailed analysis")
781
- results.push("• Or say 'debug my app' for comprehensive error analysis")
782
- }
254
+ results.push("🔄 **MONITORING ACTIVE** - Run this tool again to check for new issues")
783
255
  }
784
256
 
785
257
  return {
@@ -795,7 +267,7 @@ const handler = createMcpHandler(
795
267
  content: [
796
268
  {
797
269
  type: "text",
798
- text: `Background monitoring error: ${error instanceof Error ? error.message : String(error)}`
270
+ text: `❌ Error during debug analysis: ${error instanceof Error ? error.message : String(error)}`
799
271
  }
800
272
  ]
801
273
  }
@@ -806,7 +278,7 @@ const handler = createMcpHandler(
806
278
  // Tool to execute browser actions via CDP
807
279
  server.tool(
808
280
  "execute_browser_action",
809
- "Execute safe browser actions via Chrome DevTools Protocol for testing and interaction automation. MAGICAL VERIFICATION TOOL: This is the secret to dev3000 magic! After fixing code issues, use this tool to verify the fixes work by automating browser interactions, taking screenshots, and testing functionality. TESTING CAPABILITIES: Click elements, navigate pages, take screenshots, evaluate JavaScript expressions, scroll, and type text. SAFETY: Only whitelisted JavaScript expressions allowed, URLs restricted to http/https. THE MAGIC WORKFLOW: (1) Find issues in logs, (2) Edit code to fix them, (3) Use THIS TOOL to verify fixes work, (4) Take screenshots to show improvement. This creates the truly magical experience where AI doesn't just debug but fixes and proves the fixes work!",
281
+ "🎯 **BROWSER INTERACTION TOOL** - For testing user workflows and reproducing issues!\n\n⚡ **KEY STRATEGY:**\n🚨 **NEVER use 'screenshot' action** - dev3000 automatically captures screenshots on:\n• Page loads and navigation\n• Errors and exceptions\n• After scrolling settles\n• Network idle states\n\n✅ **CORRECT USAGE:**\n1. Use click/navigate/scroll/type to reproduce user actions\n2. Dev3000 will AUTOMATICALLY capture screenshots during these actions\n3. Check logs or use debug_my_app to see the auto-captured screenshots\n\n🔥 **AVAILABLE ACTIONS:**\n• **click** → Click buttons/links (requires x,y coordinates)\n• **navigate** Go to URLs (requires url)\n• **scroll** → Scroll pages (optional deltaX, deltaY)\n• **type** → Type text in forms (requires text)\n• **evaluate** → Read page state with JS (limited safe expressions only)\n\n❌ **DO NOT USE:**\n• **screenshot** This is for manual capture which dev3000 handles automatically\n\n💡 **BEST PRACTICE WORKFLOW:**\n1. Use debug_my_app to find issues and see existing screenshots\n2. Make code fixes\n3. Use click/navigate/type to reproduce the original user flow\n4. Dev3000 auto-captures new screenshots during your interactions\n5. Use debug_my_app again to verify fixes worked\n\n🎪 **WHY THIS WORKS BETTER:**\n• Screenshots are captured at optimal times automatically\n• You focus on reproducing user actions, not timing screenshots\n• Dev3000 handles all the screenshot complexity for you\n\n🛡️ **SAFETY:** Only safe operations allowed, whitelisted JavaScript expressions",
810
282
  {
811
283
  action: z.enum(["click", "navigate", "screenshot", "evaluate", "scroll", "type"]).describe("Action to perform"),
812
284
  params: z
@@ -884,11 +356,15 @@ const handler = createMcpHandler(
884
356
  break
885
357
 
886
358
  case "screenshot":
887
- cdpResult = await sendCDPCommand(ws, messageId++, "Page.captureScreenshot", {
888
- format: "png",
889
- quality: 80
359
+ // Discourage manual screenshots - dev3000 handles this automatically
360
+ ws.close()
361
+ resolve({
362
+ warning: "Screenshot action is not recommended!",
363
+ advice:
364
+ "Dev3000 automatically captures screenshots during interactions. Instead of manual screenshots, use click/navigate/scroll/type actions to reproduce user workflows, and dev3000 will capture screenshots at optimal times.",
365
+ suggestion: "Run debug_my_app to see all auto-captured screenshots from your session."
890
366
  })
891
- break
367
+ return
892
368
 
893
369
  case "evaluate": {
894
370
  if (!params.expression) {