dev3000 0.0.76 → 0.0.78

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 (40) hide show
  1. package/README.md +107 -27
  2. package/dist/cdp-monitor.d.ts.map +1 -1
  3. package/dist/cdp-monitor.js +33 -10
  4. package/dist/cdp-monitor.js.map +1 -1
  5. package/dist/dev-environment.d.ts +1 -1
  6. package/dist/dev-environment.d.ts.map +1 -1
  7. package/dist/dev-environment.js +201 -268
  8. package/dist/dev-environment.js.map +1 -1
  9. package/dist/src/tui-interface-impl.tsx +110 -59
  10. package/dist/tui-interface-impl.d.ts +1 -0
  11. package/dist/tui-interface-impl.d.ts.map +1 -1
  12. package/dist/tui-interface-impl.js +63 -14
  13. package/dist/tui-interface-impl.js.map +1 -1
  14. package/dist/tui-interface.d.ts +2 -0
  15. package/dist/tui-interface.d.ts.map +1 -1
  16. package/dist/tui-interface.js +8 -1
  17. package/dist/tui-interface.js.map +1 -1
  18. package/mcp-server/.next/BUILD_ID +1 -1
  19. package/mcp-server/.next/build-manifest.json +2 -2
  20. package/mcp-server/.next/fallback-build-manifest.json +2 -2
  21. package/mcp-server/.next/prerender-manifest.json +3 -3
  22. package/mcp-server/.next/server/app/_global-error.html +2 -2
  23. package/mcp-server/.next/server/app/_global-error.rsc +1 -1
  24. package/mcp-server/.next/server/app/_not-found.html +1 -1
  25. package/mcp-server/.next/server/app/_not-found.rsc +1 -1
  26. package/mcp-server/.next/server/app/index.html +1 -1
  27. package/mcp-server/.next/server/app/index.rsc +1 -1
  28. package/mcp-server/.next/server/chunks/[root-of-the-server]__270b33b7._.js +13 -23
  29. package/mcp-server/.next/server/chunks/[root-of-the-server]__270b33b7._.js.map +1 -1
  30. package/mcp-server/.next/server/chunks/ssr/_62451611._.js.map +1 -1
  31. package/mcp-server/.next/server/chunks/ssr/_b15f05ee._.js.map +1 -1
  32. package/mcp-server/.next/server/server-reference-manifest.js +1 -1
  33. package/mcp-server/.next/server/server-reference-manifest.json +1 -1
  34. package/mcp-server/app/mcp/tools.ts +686 -151
  35. package/mcp-server/package.json +0 -6
  36. package/package.json +7 -1
  37. package/src/tui-interface-impl.tsx +110 -59
  38. /package/mcp-server/.next/static/{SDKkQ5XdHwJr8jB5PJj7F → GE4QeOWMVNF-ly63PtQFE}/_buildManifest.js +0 -0
  39. /package/mcp-server/.next/static/{SDKkQ5XdHwJr8jB5PJj7F → GE4QeOWMVNF-ly63PtQFE}/_clientMiddlewareManifest.json +0 -0
  40. /package/mcp-server/.next/static/{SDKkQ5XdHwJr8jB5PJj7F → GE4QeOWMVNF-ly63PtQFE}/_ssgManifest.js +0 -0
@@ -19,7 +19,10 @@ export const TOOL_DESCRIPTIONS = {
19
19
  "🌐 **INTELLIGENT BROWSER AUTOMATION** - Smart browser action routing that automatically delegates to chrome-devtools MCP when available for superior automation capabilities.\n\n🎯 **INTELLIGENT DELEGATION:**\n• Screenshots → chrome-devtools MCP (better quality, no conflicts)\n• Navigation → chrome-devtools MCP (more reliable page handling)\n• Clicks → chrome-devtools MCP (precise coordinate-based interaction)\n• JavaScript evaluation → chrome-devtools MCP (enhanced debugging)\n• Scrolling & typing → dev3000 fallback (specialized actions)\n\n⚡ **PROGRESSIVE ENHANCEMENT:**\n• Uses chrome-devtools MCP when available for best results\n• Falls back to dev3000's native implementation when chrome-devtools unavailable\n• Shares the same Chrome instance via CDP URL coordination\n• Eliminates browser conflicts between tools\n\n💡 **PERFECT FOR:** Browser automation that automatically chooses the best tool for each action, ensuring optimal results whether chrome-devtools MCP is available or not.",
20
20
 
21
21
  discover_available_mcps:
22
- "🔍 **PROACTIVE MCP DISCOVERY** - Automatically discover other MCPs running on the system using process detection and port pinging. No need to manually specify which MCPs are available!\n\n🎯 **DISCOVERY METHODS:**\n• Process Detection: Scans running processes for known MCP patterns\n• Port Pinging: Tests standard MCP ports with HTTP/WebSocket health checks\n• Cross-Platform: Works on macOS, Linux, and Windows\n\n⚡ **SMART DETECTION:**\n• Detects nextjs-dev, chrome-devtools, and other common MCPs\n• Fallback from process detection to port pinging\n• Logs all discovery attempts for transparency\n\n💡 **PERFECT FOR:** 'What MCPs are available?' or when you want dev3000 to automatically find and integrate with other debugging tools!"
22
+ "🔍 **PROACTIVE MCP DISCOVERY** - Automatically discover other MCPs running on the system using process detection and port pinging. No need to manually specify which MCPs are available!\n\n🎯 **DISCOVERY METHODS:**\n• Process Detection: Scans running processes for known MCP patterns\n• Port Pinging: Tests standard MCP ports with HTTP/WebSocket health checks\n• Cross-Platform: Works on macOS, Linux, and Windows\n\n⚡ **SMART DETECTION:**\n• Detects nextjs-dev, chrome-devtools, and other common MCPs\n• Fallback from process detection to port pinging\n• Logs all discovery attempts for transparency\n\n💡 **PERFECT FOR:** 'What MCPs are available?' or when you want dev3000 to automatically find and integrate with other debugging tools!",
23
+
24
+ get_mcp_capabilities:
25
+ "🔍 **MCP CAPABILITY INSPECTOR** - Discover and inspect the current capabilities of available MCPs (dev3000-chrome-devtools and dev3000-nextjs-dev). Shows dynamically discovered functions with descriptions and categories. Perfect for understanding what enhanced capabilities are available for augmented delegation.\n\n⚡ **DYNAMIC DISCOVERY:**\n• Introspects MCP logs and schemas to find available functions\n• Categorizes capabilities as 'advanced' vs 'basic'\n• Generates intelligent descriptions based on function names\n• Caches results for performance (5min TTL)\n\n🎯 **REAL-TIME UPDATES:**\n• Automatically adapts when MCPs add new capabilities\n• No manual maintenance required\n• Always shows current state of available tools\n\n💡 **PERFECT FOR:** Understanding what enhanced capabilities are currently available, debugging MCP integration issues, or planning augmented debugging workflows."
23
26
  }
24
27
 
25
28
  // Types
@@ -54,6 +57,10 @@ export interface ExecuteBrowserActionParams {
54
57
  params?: Record<string, unknown>
55
58
  }
56
59
 
60
+ export interface GetMcpCapabilitiesParams {
61
+ mcpName?: string // Optional - if not provided, shows all available MCPs
62
+ }
63
+
57
64
  // Structured data types for raw data output
58
65
  export interface ErrorWithInteractions {
59
66
  timestamp: string
@@ -531,7 +538,7 @@ export async function fixMyApp({
531
538
  if (integrateNextjs) {
532
539
  results.push("")
533
540
  results.push("⚛️ **Next.js Integration Active:**")
534
- const nextjsSuggestions = generateNextjsSuggestions(allErrors.join(" "))
541
+ const nextjsSuggestions = await generateNextjsSuggestions(allErrors.join(" "))
535
542
  nextjsSuggestions.forEach((suggestion) => {
536
543
  const params = suggestion.params
537
544
  ? `(${Object.entries(suggestion.params)
@@ -552,7 +559,7 @@ export async function fixMyApp({
552
559
  if (integrateChromeDevtools) {
553
560
  results.push("")
554
561
  results.push("🌐 **Chrome DevTools Integration Active:**")
555
- const chromeSuggestions = generateChromeDevtoolsSuggestions(allErrors.join(" "))
562
+ const chromeSuggestions = await generateChromeDevtoolsSuggestions(allErrors.join(" "))
556
563
  chromeSuggestions.forEach((suggestion) => {
557
564
  const params = suggestion.params
558
565
  ? `(${Object.entries(suggestion.params)
@@ -729,11 +736,11 @@ const value = data?.property?.nestedProperty`,
729
736
  const suggestedIntegrations: StructuredAnalysisResult["suggestedIntegrations"] = {}
730
737
 
731
738
  if (integrateNextjs) {
732
- suggestedIntegrations.nextjs = generateNextjsSuggestions(allErrors.join(" "))
739
+ suggestedIntegrations.nextjs = await generateNextjsSuggestions(allErrors.join(" "))
733
740
  }
734
741
 
735
742
  if (integrateChromeDevtools) {
736
- suggestedIntegrations.chrome = generateChromeDevtoolsSuggestions(allErrors.join(" "))
743
+ suggestedIntegrations.chrome = await generateChromeDevtoolsSuggestions(allErrors.join(" "))
737
744
  }
738
745
 
739
746
  // Create workflow plan if integrations are available
@@ -834,13 +841,37 @@ const value = data?.property?.nestedProperty`,
834
841
  }
835
842
  }
836
843
 
837
- // Add nextjs-dev delegation recommendation if available
838
- if (canDelegateNextjs) {
844
+ // Add augmented analysis suggestions when specialized MCPs are available
845
+ const canDelegateChrome = await canDelegateToChromeDevtools("profile_performance")
846
+
847
+ if (canDelegateNextjs || canDelegateChrome) {
839
848
  results.push("")
840
- results.push("🔗 **ENHANCED NEXT.JS ANALYSIS AVAILABLE**")
849
+ results.push("🔗 **AUGMENTED ANALYSIS AVAILABLE**")
841
850
  results.push("")
842
- const delegationResponse = await delegateToNextjs()
843
- results.push(delegationResponse.content[0].text)
851
+ results.push("dev3000 provided the core log analysis above. For deeper insights, consider also gathering:")
852
+ results.push("")
853
+
854
+ if (canDelegateNextjs) {
855
+ results.push("**Next.js Framework Analysis:**")
856
+ const dynamicNextjsSuggestions = await generateNextjsSuggestions(allErrors.join(" "))
857
+ dynamicNextjsSuggestions.slice(0, 3).forEach((suggestion) => {
858
+ results.push(`• \`dev3000-nextjs-dev:${suggestion.function}()\` - ${suggestion.reason}`)
859
+ })
860
+ results.push("")
861
+ }
862
+
863
+ if (canDelegateChrome) {
864
+ results.push("**Browser-Side Analysis:**")
865
+ const dynamicChromeSuggestions = await generateChromeDevtoolsSuggestions(allErrors.join(" "))
866
+ dynamicChromeSuggestions.slice(0, 3).forEach((suggestion) => {
867
+ results.push(`• \`dev3000-chrome-devtools:${suggestion.function}()\` - ${suggestion.reason}`)
868
+ })
869
+ results.push("")
870
+ }
871
+
872
+ results.push(
873
+ "💡 **Best approach:** Use dev3000's log analysis as your foundation, then gather specific additional data as needed for a complete picture."
874
+ )
844
875
  }
845
876
 
846
877
  return {
@@ -858,65 +889,351 @@ const value = data?.property?.nestedProperty`,
858
889
  }
859
890
  }
860
891
 
861
- // Capability mapping between dev3000 and chrome-devtools MCP
862
- const CHROME_DEVTOOLS_CAPABILITY_MAP: Record<
863
- string,
864
- { function: string; paramMap?: (params: Record<string, unknown>) => Record<string, unknown> }
865
- > = {
866
- screenshot: {
867
- function: "take_screenshot",
868
- paramMap: () => ({}) // chrome-devtools doesn't need params for screenshots
869
- },
870
- navigate: {
871
- function: "navigate_page",
872
- paramMap: (params) => ({ url: params.url })
873
- },
874
- click: {
875
- function: "click",
876
- paramMap: (params) => ({ x: params.x, y: params.y })
877
- },
878
- evaluate: {
879
- function: "execute_script", // Assuming chrome-devtools has this
880
- paramMap: (params) => ({ script: params.expression })
892
+ // Dynamic MCP capability discovery and filtering
893
+ interface McpCapability {
894
+ function: string
895
+ description?: string
896
+ parameters?: Record<string, unknown>
897
+ category: "advanced" | "basic"
898
+ reason: string
899
+ }
900
+
901
+ interface McpSchemaCache {
902
+ timestamp: number
903
+ capabilities: McpCapability[]
904
+ }
905
+
906
+ // Cache for discovered MCP capabilities (5 minute TTL)
907
+ const MCP_CAPABILITY_CACHE = new Map<string, McpSchemaCache>()
908
+ const CAPABILITY_CACHE_TTL = 5 * 60 * 1000 // 5 minutes
909
+
910
+ // Keywords that indicate advanced capabilities (vs basic automation)
911
+ const ADVANCED_CAPABILITY_KEYWORDS = {
912
+ chrome: [
913
+ "inspect",
914
+ "debug",
915
+ "profile",
916
+ "performance",
917
+ "console",
918
+ "devtools",
919
+ "breakpoint",
920
+ "intercept",
921
+ "storage",
922
+ "memory",
923
+ "trace"
924
+ ],
925
+ nextjs: ["build", "hydration", "ssr", "routing", "analyze", "debug", "render", "middleware", "optimization"]
926
+ }
927
+
928
+ // Basic capabilities that dev3000 handles well (should not suggest these)
929
+ const DEV3000_BASIC_CAPABILITIES = [
930
+ "screenshot",
931
+ "navigate",
932
+ "click",
933
+ "type",
934
+ "scroll",
935
+ "evaluate",
936
+ "simple_script",
937
+ "get_logs",
938
+ "basic_build_status",
939
+ "simple_error_check"
940
+ ]
941
+
942
+ /**
943
+ * Dynamically discover MCP capabilities by introspecting their schemas
944
+ */
945
+ async function discoverMcpCapabilities(mcpName: string): Promise<McpCapability[]> {
946
+ const cacheKey = mcpName
947
+ const cached = MCP_CAPABILITY_CACHE.get(cacheKey)
948
+
949
+ // Return cached capabilities if still fresh
950
+ if (cached && Date.now() - cached.timestamp < CAPABILITY_CACHE_TTL) {
951
+ logToDevFile(
952
+ `Capability Discovery: Using cached capabilities for ${mcpName} (${cached.capabilities.length} functions)`
953
+ )
954
+ return cached.capabilities
955
+ }
956
+
957
+ logToDevFile(`Capability Discovery: Fetching fresh capabilities for ${mcpName}`)
958
+
959
+ try {
960
+ // Method 1: Try to get MCP schema via tools/list request (MCP protocol standard)
961
+ const capabilities = await introspectMcpTools(mcpName)
962
+
963
+ if (capabilities.length > 0) {
964
+ // Cache the results
965
+ MCP_CAPABILITY_CACHE.set(cacheKey, {
966
+ timestamp: Date.now(),
967
+ capabilities
968
+ })
969
+
970
+ logToDevFile(`Capability Discovery: Successfully discovered ${capabilities.length} capabilities for ${mcpName}`)
971
+ return capabilities
972
+ }
973
+
974
+ // Method 2: Fallback to checking available function names from logs/errors
975
+ const fallbackCapabilities = await inferCapabilitiesFromLogs(mcpName)
976
+
977
+ // Cache even fallback results to avoid repeated failures
978
+ MCP_CAPABILITY_CACHE.set(cacheKey, {
979
+ timestamp: Date.now(),
980
+ capabilities: fallbackCapabilities
981
+ })
982
+
983
+ logToDevFile(
984
+ `Capability Discovery: Using fallback inference for ${mcpName} (${fallbackCapabilities.length} functions)`
985
+ )
986
+ return fallbackCapabilities
987
+ } catch (error) {
988
+ logToDevFile(`Capability Discovery: Failed to discover capabilities for ${mcpName} - ${error}`)
989
+ return []
881
990
  }
882
- // scroll and type don't have direct chrome-devtools equivalents, fall back to dev3000
883
991
  }
884
992
 
885
- // Capability mapping for nextjs-dev MCP delegation
886
- const NEXTJS_DEV_CAPABILITY_MAP: Record<string, { function: string; reason: string }> = {
887
- get_build_status: {
888
- function: "get_build_status",
889
- reason: "Get comprehensive Next.js build information and status"
890
- },
891
- get_server_logs: {
892
- function: "get_server_logs",
893
- reason: "Access Next.js server-side logs and runtime information"
894
- },
895
- analyze_performance: {
896
- function: "analyze_performance",
897
- reason: "Get Next.js-specific performance metrics and optimization suggestions"
898
- },
899
- check_routes: {
900
- function: "check_routes",
901
- reason: "Validate Next.js routing configuration and detect issues"
993
+ /**
994
+ * Introspect MCP tools using the standard tools/list request
995
+ */
996
+ async function introspectMcpTools(mcpName: string): Promise<McpCapability[]> {
997
+ // For stdio MCPs, we can try to discover their capabilities by checking Claude's cache directory
998
+ // which often contains MCP schema information or error logs that reveal function names
999
+
1000
+ try {
1001
+ const cacheDir = `/Users/${process.env.USER}/Library/Caches/claude-cli-nodejs`
1002
+ const { readdirSync, existsSync, readFileSync } = await import("fs")
1003
+
1004
+ if (!existsSync(cacheDir)) return []
1005
+
1006
+ const cacheDirs = readdirSync(cacheDir)
1007
+ const projectDir = cacheDirs.find((dir) => dir.includes(process.cwd().replace(/\//g, "-")))
1008
+
1009
+ if (!projectDir) return []
1010
+
1011
+ const mcpLogDir = `${cacheDir}/${projectDir}/mcp-logs-${mcpName}`
1012
+ if (!existsSync(mcpLogDir)) return []
1013
+
1014
+ // Look for schema information in MCP logs
1015
+ const logFiles = readdirSync(mcpLogDir)
1016
+ const capabilities: McpCapability[] = []
1017
+
1018
+ for (const logFile of logFiles.slice(-5)) {
1019
+ // Check recent logs only
1020
+ try {
1021
+ const logPath = `${mcpLogDir}/${logFile}`
1022
+ const logContent = readFileSync(logPath, "utf8")
1023
+
1024
+ // Parse log content for function definitions, tool lists, or schema information
1025
+ const discoveredFunctions = extractFunctionsFromLog(logContent, mcpName)
1026
+ capabilities.push(...discoveredFunctions)
1027
+ } catch (_error) {
1028
+ // Skip files that can't be read
1029
+ }
1030
+ }
1031
+
1032
+ return deduplicateCapabilities(capabilities)
1033
+ } catch (error) {
1034
+ logToDevFile(`MCP Introspection: Failed to introspect ${mcpName} - ${error}`)
1035
+ return []
1036
+ }
1037
+ }
1038
+
1039
+ /**
1040
+ * Extract function names and descriptions from MCP log content
1041
+ */
1042
+ function extractFunctionsFromLog(logContent: string, mcpName: string): McpCapability[] {
1043
+ const capabilities: McpCapability[] = []
1044
+ const mcpType: "chrome" | "nextjs" = mcpName.includes("chrome")
1045
+ ? "chrome"
1046
+ : mcpName.includes("nextjs")
1047
+ ? "nextjs"
1048
+ : "chrome" // default to chrome if unknown
1049
+ const advancedKeywords = ADVANCED_CAPABILITY_KEYWORDS[mcpType]
1050
+
1051
+ // Look for function definitions in various formats
1052
+ const patterns = [
1053
+ // JSON-RPC method calls: {"method": "tools/list", "result": {"tools": [{"name": "function_name", "description": "..."}]}}
1054
+ /"name":\s*"([^"]+)"/g,
1055
+ // Function call patterns: functionName(params)
1056
+ /(\w+)\s*\([^)]*\)/g,
1057
+ // Tool definition patterns: tool: function_name
1058
+ /tool:\s*(\w+)/g,
1059
+ // Error messages that reveal function names: "Unknown function: function_name"
1060
+ /unknown function[:\s]+(\w+)/gi,
1061
+ // Function export patterns: exports.function_name
1062
+ /exports\.(\w+)/g
1063
+ ]
1064
+
1065
+ for (const pattern of patterns) {
1066
+ let match: RegExpExecArray | null = pattern.exec(logContent)
1067
+ while (match !== null) {
1068
+ const functionName = match[1]
1069
+
1070
+ // Skip if this is a basic capability that dev3000 handles
1071
+ if (DEV3000_BASIC_CAPABILITIES.some((basic) => functionName.toLowerCase().includes(basic))) {
1072
+ match = pattern.exec(logContent)
1073
+ continue
1074
+ }
1075
+
1076
+ // Determine if this is an advanced capability
1077
+ const isAdvanced = advancedKeywords.some((keyword) => functionName.toLowerCase().includes(keyword))
1078
+
1079
+ // Generate reason based on function name and MCP type
1080
+ const reason = generateCapabilityReason(functionName, mcpType, isAdvanced)
1081
+
1082
+ capabilities.push({
1083
+ function: functionName,
1084
+ description: undefined, // Will be filled from actual description if available
1085
+ category: isAdvanced ? "advanced" : "basic",
1086
+ reason
1087
+ })
1088
+
1089
+ match = pattern.exec(logContent)
1090
+ }
1091
+ }
1092
+
1093
+ return capabilities
1094
+ }
1095
+
1096
+ /**
1097
+ * Generate intelligent reason text for a discovered capability
1098
+ */
1099
+ function generateCapabilityReason(functionName: string, mcpType: string, isAdvanced: boolean): string {
1100
+ const name = functionName.toLowerCase()
1101
+
1102
+ // Chrome DevTools specific reasons
1103
+ if (mcpType === "chrome") {
1104
+ if (name.includes("inspect")) return "Deep DOM inspection with DevTools-level detail"
1105
+ if (name.includes("console")) return "Direct browser console access and manipulation"
1106
+ if (name.includes("debug") || name.includes("breakpoint"))
1107
+ return "JavaScript debugging with breakpoints and call stack"
1108
+ if (name.includes("profile") || name.includes("performance")) return "Advanced performance profiling and analysis"
1109
+ if (name.includes("network") || name.includes("request")) return "Network request interception and analysis"
1110
+ if (name.includes("storage")) return "Browser storage manipulation (cookies, localStorage, etc.)"
1111
+ if (name.includes("trace") || name.includes("memory")) return "Memory usage and execution tracing"
1112
+ }
1113
+
1114
+ // Next.js specific reasons
1115
+ if (mcpType === "nextjs") {
1116
+ if (name.includes("build")) return "Advanced Next.js build system analysis"
1117
+ if (name.includes("hydration")) return "Client-server hydration debugging and analysis"
1118
+ if (name.includes("ssr") || name.includes("render")) return "Server-side rendering debugging"
1119
+ if (name.includes("route") || name.includes("routing")) return "Next.js routing system inspection and debugging"
1120
+ if (name.includes("middleware")) return "Next.js middleware analysis and debugging"
1121
+ if (name.includes("optimization") || name.includes("performance"))
1122
+ return "Next.js-specific performance optimization"
1123
+ }
1124
+
1125
+ // Generic advanced vs basic
1126
+ if (isAdvanced) {
1127
+ return `Advanced ${mcpType} capability beyond dev3000's basic automation`
1128
+ }
1129
+
1130
+ return `${mcpType} capability for specialized analysis`
1131
+ }
1132
+
1133
+ /**
1134
+ * Infer capabilities from error patterns and log analysis when direct introspection fails
1135
+ */
1136
+ async function inferCapabilitiesFromLogs(mcpName: string): Promise<McpCapability[]> {
1137
+ // This is a fallback when we can't directly introspect the MCP
1138
+ // We'll return commonly expected capabilities based on the MCP type
1139
+
1140
+ const mcpType = mcpName.includes("chrome") ? "chrome" : mcpName.includes("nextjs") ? "nextjs" : "unknown"
1141
+ const capabilities: McpCapability[] = []
1142
+
1143
+ if (mcpType === "chrome") {
1144
+ // Common chrome-devtools capabilities that are likely to exist
1145
+ const commonChromeFunctions = [
1146
+ "inspect_element",
1147
+ "access_console",
1148
+ "start_performance_profile",
1149
+ "intercept_requests",
1150
+ "set_breakpoint",
1151
+ "take_screenshot",
1152
+ "get_dom_snapshot",
1153
+ "modify_storage",
1154
+ "execute_script"
1155
+ ]
1156
+
1157
+ for (const func of commonChromeFunctions) {
1158
+ capabilities.push({
1159
+ function: func,
1160
+ category: DEV3000_BASIC_CAPABILITIES.includes(func) ? "basic" : "advanced",
1161
+ reason: generateCapabilityReason(func, mcpType, true)
1162
+ })
1163
+ }
902
1164
  }
1165
+
1166
+ if (mcpType === "nextjs") {
1167
+ // Common nextjs-dev capabilities that are likely to exist
1168
+ const commonNextjsFunctions = [
1169
+ "analyze_build_process",
1170
+ "debug_server_rendering",
1171
+ "debug_hydration",
1172
+ "inspect_routing",
1173
+ "analyze_next_performance",
1174
+ "get_build_info",
1175
+ "check_build_status",
1176
+ "get_server_logs"
1177
+ ]
1178
+
1179
+ for (const func of commonNextjsFunctions) {
1180
+ capabilities.push({
1181
+ function: func,
1182
+ category: DEV3000_BASIC_CAPABILITIES.includes(func) ? "basic" : "advanced",
1183
+ reason: generateCapabilityReason(func, mcpType, true)
1184
+ })
1185
+ }
1186
+ }
1187
+
1188
+ logToDevFile(`Capability Inference: Generated ${capabilities.length} inferred capabilities for ${mcpName}`)
1189
+ return capabilities
1190
+ }
1191
+
1192
+ /**
1193
+ * Remove duplicate capabilities while preserving the most detailed ones
1194
+ */
1195
+ function deduplicateCapabilities(capabilities: McpCapability[]): McpCapability[] {
1196
+ const seen = new Map<string, McpCapability>()
1197
+
1198
+ for (const capability of capabilities) {
1199
+ const existing = seen.get(capability.function)
1200
+
1201
+ // Keep the one with more information (description, better reason, etc.)
1202
+ if (
1203
+ !existing ||
1204
+ (capability.description && !existing.description) ||
1205
+ capability.reason.length > existing.reason.length
1206
+ ) {
1207
+ seen.set(capability.function, capability)
1208
+ }
1209
+ }
1210
+
1211
+ return Array.from(seen.values())
903
1212
  }
904
1213
 
905
1214
  /**
906
- * Check if chrome-devtools MCP is available and can handle the requested action
1215
+ * Check if chrome-devtools MCP is available and get its capabilities
907
1216
  */
908
- async function canDelegateToChromeDevtools(action: string): Promise<boolean> {
1217
+ async function canDelegateToChromeDevtools(action?: string): Promise<boolean> {
909
1218
  try {
910
- // First check if the action is mappable to chrome-devtools
911
- if (!CHROME_DEVTOOLS_CAPABILITY_MAP[action]) {
1219
+ // Check if MCP is available
1220
+ const availableMcps = await discoverAvailableMcps()
1221
+ if (!availableMcps.includes("dev3000-chrome-devtools")) {
912
1222
  return false
913
1223
  }
914
1224
 
915
- // Only look for dev3000's own configured chrome-devtools MCP
916
- const availableMcps = await discoverAvailableMcps()
1225
+ // If no specific action, just return availability
1226
+ if (!action) return true
917
1227
 
918
- // Check for dev3000's own configured chrome-devtools MCP
919
- return availableMcps.includes("dev3000-chrome-devtools")
1228
+ // Get dynamic capabilities
1229
+ const capabilities = await discoverMcpCapabilities("dev3000-chrome-devtools")
1230
+
1231
+ // Check if the MCP has relevant capabilities for the action
1232
+ const hasRelevantCapability = capabilities.some(
1233
+ (cap) => cap.function.toLowerCase().includes(action.toLowerCase()) || cap.category === "advanced" // Any advanced capability indicates delegation worthiness
1234
+ )
1235
+
1236
+ return hasRelevantCapability
920
1237
  } catch (error) {
921
1238
  logToDevFile(`Chrome DevTools delegation check failed: ${error}`)
922
1239
  return false
@@ -924,15 +1241,21 @@ async function canDelegateToChromeDevtools(action: string): Promise<boolean> {
924
1241
  }
925
1242
 
926
1243
  /**
927
- * Check if nextjs-dev MCP is available
1244
+ * Check if nextjs-dev MCP is available and get its capabilities
928
1245
  */
929
1246
  async function canDelegateToNextjs(): Promise<boolean> {
930
1247
  try {
931
- // Only look for dev3000's own configured nextjs-dev MCP
1248
+ // Check if MCP is available
932
1249
  const availableMcps = await discoverAvailableMcps()
1250
+ if (!availableMcps.includes("dev3000-nextjs-dev")) {
1251
+ return false
1252
+ }
933
1253
 
934
- // Check for dev3000's own configured nextjs-dev MCP
935
- return availableMcps.includes("dev3000-nextjs-dev")
1254
+ // Get dynamic capabilities to verify it has useful functions
1255
+ const capabilities = await discoverMcpCapabilities("dev3000-nextjs-dev")
1256
+
1257
+ // Return true if we found any advanced Next.js capabilities
1258
+ return capabilities.some((cap) => cap.category === "advanced")
936
1259
  } catch (error) {
937
1260
  logToDevFile(`NextJS delegation check failed: ${error}`)
938
1261
  return false
@@ -946,32 +1269,39 @@ async function delegateToChromeDevtools(
946
1269
  action: string,
947
1270
  params: Record<string, unknown>
948
1271
  ): Promise<{ content: Array<{ type: "text"; text: string }> }> {
949
- const mapping = CHROME_DEVTOOLS_CAPABILITY_MAP[action]
950
- if (!mapping) {
1272
+ // Get dynamic capabilities from chrome-devtools MCP
1273
+ const capabilities = await discoverMcpCapabilities("dev3000-chrome-devtools")
1274
+
1275
+ // Find a relevant capability for this action
1276
+ const relevantCap = capabilities.find(
1277
+ (cap) =>
1278
+ cap.function.toLowerCase().includes(action.toLowerCase()) ||
1279
+ cap.description?.toLowerCase().includes(action.toLowerCase())
1280
+ )
1281
+
1282
+ if (!relevantCap) {
951
1283
  throw new Error(`Action ${action} cannot be delegated to chrome-devtools`)
952
1284
  }
953
1285
 
954
- // Transform parameters if needed
955
- const chromeParams = mapping.paramMap ? mapping.paramMap(params) : params
956
-
957
1286
  return {
958
1287
  content: [
959
1288
  {
960
1289
  type: "text",
961
- text: `🔗 **USE DEV3000-CHROME-DEVTOOLS MCP**
1290
+ text: `🔗 **ADVANCED BROWSER DEBUGGING AVAILABLE**
962
1291
 
963
- If you have chrome-devtools MCP configured, please use the \`dev3000-chrome-devtools\` MCP directly:
1292
+ For advanced debugging capabilities, use the \`dev3000-chrome-devtools\` MCP:
964
1293
 
965
1294
  \`\`\`
966
- dev3000-chrome-devtools:${mapping.function}(${JSON.stringify(chromeParams, null, 2)})
1295
+ dev3000-chrome-devtools:${relevantCap.function}(${JSON.stringify(params, null, 2)})
967
1296
  \`\`\`
968
1297
 
969
- 💡 **If the MCP is not available:**
970
- • Make sure chrome-devtools MCP is configured in your Claude Code client
971
- • Claude Code should auto-configure it as \`dev3000-chrome-devtools\`
972
- • Alternatively, dev3000 will fallback to its basic browser automation
1298
+ 🎯 **Why use chrome-devtools for this:** ${relevantCap.reason}
973
1299
 
974
- **Note:** dev3000 detected chrome-devtools activity but cannot verify MCP configuration`
1300
+ 💡 **When to use each tool:**
1301
+ • **dev3000**: Basic browser automation (screenshots, navigation, clicks, simple scripts)
1302
+ • **dev3000-chrome-devtools**: Advanced debugging (DOM inspection, breakpoints, performance profiling, network interception)
1303
+
1304
+ ⚡ **Both tools share the same Chrome instance** - no conflicts or duplicate browsers`
975
1305
  }
976
1306
  ]
977
1307
  }
@@ -980,28 +1310,30 @@ dev3000-chrome-devtools:${mapping.function}(${JSON.stringify(chromeParams, null,
980
1310
  /**
981
1311
  * Delegate to nextjs-dev MCP with suggested functions
982
1312
  */
983
- async function delegateToNextjs(): Promise<{ content: Array<{ type: "text"; text: string }> }> {
984
- const availableFunctions = Object.entries(NEXTJS_DEV_CAPABILITY_MAP)
985
- .map(([_key, { function: func, reason }]) => `• \`dev3000-nextjs-dev:${func}()\` - ${reason}`)
1313
+ async function _delegateToNextjs(): Promise<{ content: Array<{ type: "text"; text: string }> }> {
1314
+ // Get dynamic capabilities from nextjs-dev MCP
1315
+ const capabilities = await discoverMcpCapabilities("dev3000-nextjs-dev")
1316
+
1317
+ const availableFunctions = capabilities
1318
+ .map((cap) => `• \`dev3000-nextjs-dev:${cap.function}()\` - ${cap.reason}`)
986
1319
  .join("\n")
987
1320
 
988
1321
  return {
989
1322
  content: [
990
1323
  {
991
1324
  type: "text",
992
- text: `🔗 **USE DEV3000-NEXTJS-DEV MCP**
1325
+ text: `🔗 **ADVANCED NEXT.JS ANALYSIS AVAILABLE**
993
1326
 
994
- Please use the \`dev3000-nextjs-dev\` MCP directly for Next.js-specific analysis:
1327
+ For Next.js-specific advanced analysis, use the \`dev3000-nextjs-dev\` MCP:
995
1328
 
996
- **Available Functions:**
1329
+ **Available Advanced Functions:**
997
1330
  ${availableFunctions}
998
1331
 
999
- 💡 **Why this approach:**
1000
- nextjs-dev is a stdio MCP server that Claude calls directly
1001
- Provides Next.js-specific build, server, and performance insights
1002
- • Direct MCP calls give better framework-specific context
1332
+ 💡 **When to use each tool:**
1333
+ **dev3000**: General log analysis, basic error detection, simple build monitoring
1334
+ **dev3000-nextjs-dev**: Advanced Next.js debugging (SSR issues, hydration problems, build system analysis, routing inspection)
1003
1335
 
1004
- ⚡ **Auto-configured as:** \`dev3000-nextjs-dev\` in your MCP client`
1336
+ ⚡ **Best of both worlds:** Use dev3000 for general monitoring and nextjs-dev for framework-specific deep dives`
1005
1337
  }
1006
1338
  ]
1007
1339
  }
@@ -1256,11 +1588,46 @@ export async function executeBrowserAction({
1256
1588
  ws.on("error", reject)
1257
1589
  })
1258
1590
 
1591
+ // Build success message with augmented suggestions
1592
+ let successMessage = `Browser action '${action}' executed successfully. Result: ${JSON.stringify(result, null, 2)}`
1593
+
1594
+ // Add augmented suggestions for enhanced capabilities
1595
+ const canDelegateChrome = await canDelegateToChromeDevtools("inspect_element")
1596
+ if (canDelegateChrome) {
1597
+ successMessage += "\n\n🔗 **ENHANCED BROWSER ANALYSIS AVAILABLE**"
1598
+ successMessage +=
1599
+ "\n\ndev3000 completed the basic browser action above. For deeper browser insights, consider also:"
1600
+
1601
+ // Generate dynamic suggestions based on the action and available capabilities
1602
+ const dynamicSuggestions = await generateChromeDevtoolsSuggestions(action)
1603
+ const actionRelevantSuggestions = dynamicSuggestions.filter((suggestion) => {
1604
+ const funcName = suggestion.function.toLowerCase()
1605
+ const actionName = action.toLowerCase()
1606
+
1607
+ // Match suggestions to specific actions
1608
+ if (actionName === "screenshot" && (funcName.includes("inspect") || funcName.includes("performance")))
1609
+ return true
1610
+ if (actionName === "evaluate" && (funcName.includes("console") || funcName.includes("inspect"))) return true
1611
+ if (actionName === "navigate" && (funcName.includes("network") || funcName.includes("performance"))) return true
1612
+ if (actionName === "click" && (funcName.includes("console") || funcName.includes("inspect"))) return true
1613
+
1614
+ // Include high-priority suggestions regardless
1615
+ return suggestion.priority === "high"
1616
+ })
1617
+
1618
+ actionRelevantSuggestions.slice(0, 2).forEach((suggestion) => {
1619
+ successMessage += `\n• \`dev3000-chrome-devtools:${suggestion.function}()\` - ${suggestion.reason}`
1620
+ })
1621
+
1622
+ successMessage +=
1623
+ "\n\n💡 **Augmented approach:** Use dev3000 for basic automation, chrome-devtools for detailed analysis and debugging."
1624
+ }
1625
+
1259
1626
  return {
1260
1627
  content: [
1261
1628
  {
1262
1629
  type: "text",
1263
- text: `Browser action '${action}' executed successfully. Result: ${JSON.stringify(result, null, 2)}`
1630
+ text: successMessage
1264
1631
  }
1265
1632
  ]
1266
1633
  }
@@ -1472,6 +1839,140 @@ export async function discoverAvailableMcps(projectName?: string): Promise<strin
1472
1839
  return finalMcps
1473
1840
  }
1474
1841
 
1842
+ /**
1843
+ * Get and display MCP capabilities for debugging and inspection
1844
+ */
1845
+ export async function getMcpCapabilities({
1846
+ mcpName
1847
+ }: GetMcpCapabilitiesParams = {}): Promise<{ content: Array<{ type: "text"; text: string }> }> {
1848
+ const results: string[] = []
1849
+
1850
+ results.push("🔍 **MCP CAPABILITY INSPECTOR**")
1851
+ results.push("")
1852
+
1853
+ try {
1854
+ // Discover available MCPs if no specific one requested
1855
+ const availableMcps = await discoverAvailableMcps()
1856
+
1857
+ if (availableMcps.length === 0) {
1858
+ results.push("❌ **NO MCPs DETECTED**")
1859
+ results.push("No dev3000-chrome-devtools or dev3000-nextjs-dev MCPs found.")
1860
+ results.push("")
1861
+ results.push("💡 **To enable enhanced capabilities:**")
1862
+ results.push("• Ensure Chrome DevTools MCP is configured: `dev3000-chrome-devtools`")
1863
+ results.push("• Ensure Next.js Dev MCP is configured: `dev3000-nextjs-dev`")
1864
+ results.push("• Check that Claude Code has MCPs properly configured")
1865
+
1866
+ return {
1867
+ content: [{ type: "text", text: results.join("\n") }]
1868
+ }
1869
+ }
1870
+
1871
+ results.push(`✅ **DISCOVERED MCPs:** ${availableMcps.join(", ")}`)
1872
+ results.push("")
1873
+
1874
+ // Filter to specific MCP if requested
1875
+ const mcpsToInspect = mcpName ? availableMcps.filter((name) => name.includes(mcpName)) : availableMcps
1876
+
1877
+ if (mcpsToInspect.length === 0 && mcpName) {
1878
+ results.push(`❌ **MCP NOT FOUND:** ${mcpName}`)
1879
+ results.push(`Available MCPs: ${availableMcps.join(", ")}`)
1880
+
1881
+ return {
1882
+ content: [{ type: "text", text: results.join("\n") }]
1883
+ }
1884
+ }
1885
+
1886
+ // Inspect capabilities for each MCP
1887
+ for (const mcp of mcpsToInspect) {
1888
+ results.push(`📋 **${mcp.toUpperCase()} CAPABILITIES:**`)
1889
+ results.push("")
1890
+
1891
+ const capabilities = await discoverMcpCapabilities(mcp)
1892
+
1893
+ if (capabilities.length === 0) {
1894
+ results.push(" ❌ No capabilities discovered")
1895
+ results.push(" 💡 This might indicate the MCP is not properly configured or accessible")
1896
+ results.push("")
1897
+ continue
1898
+ }
1899
+
1900
+ // Group by category
1901
+ const advanced = capabilities.filter((cap) => cap.category === "advanced")
1902
+ const basic = capabilities.filter((cap) => cap.category === "basic")
1903
+
1904
+ results.push(` 🚀 **ADVANCED CAPABILITIES** (${advanced.length} functions):`)
1905
+ if (advanced.length > 0) {
1906
+ advanced.forEach((cap) => {
1907
+ results.push(` • \`${cap.function}()\` - ${cap.reason}`)
1908
+ })
1909
+ } else {
1910
+ results.push(" No advanced capabilities discovered")
1911
+ }
1912
+ results.push("")
1913
+
1914
+ results.push(` ⚙️ **BASIC CAPABILITIES** (${basic.length} functions):`)
1915
+ if (basic.length > 0) {
1916
+ basic.forEach((cap) => {
1917
+ results.push(` • \`${cap.function}()\` - ${cap.reason}`)
1918
+ })
1919
+ } else {
1920
+ results.push(" No basic capabilities discovered")
1921
+ }
1922
+ results.push("")
1923
+
1924
+ // Cache info
1925
+ const cached = MCP_CAPABILITY_CACHE.get(mcp)
1926
+ if (cached) {
1927
+ const age = Date.now() - cached.timestamp
1928
+ const ageMinutes = Math.floor(age / 60000)
1929
+ results.push(` 📝 **CACHE INFO:** Discovered ${ageMinutes} minutes ago`)
1930
+ if (age > CAPABILITY_CACHE_TTL * 0.8) {
1931
+ results.push(" ⚠️ Cache will refresh soon on next use")
1932
+ }
1933
+ }
1934
+ results.push("")
1935
+ }
1936
+
1937
+ // Summary
1938
+ const totalCapabilities = mcpsToInspect.reduce(async (accPromise, mcp) => {
1939
+ const acc = await accPromise
1940
+ const caps = await discoverMcpCapabilities(mcp)
1941
+ return acc + caps.length
1942
+ }, Promise.resolve(0))
1943
+
1944
+ results.push("🎯 **AUGMENTED DELEGATION STATUS:**")
1945
+ results.push(`• Total discovered capabilities: ${await totalCapabilities}`)
1946
+ results.push(
1947
+ `• MCPs with advanced capabilities: ${
1948
+ mcpsToInspect.filter(async (mcp) => {
1949
+ const caps = await discoverMcpCapabilities(mcp)
1950
+ return caps.some((cap) => cap.category === "advanced")
1951
+ }).length
1952
+ }`
1953
+ )
1954
+ results.push("• Dynamic discovery: ✅ Active (updates automatically)")
1955
+ results.push("• Cache TTL: 5 minutes")
1956
+ results.push("")
1957
+ results.push("💡 **These capabilities are automatically suggested in dev3000's enhanced responses!**")
1958
+
1959
+ return {
1960
+ content: [{ type: "text", text: results.join("\n") }]
1961
+ }
1962
+ } catch (error) {
1963
+ results.push(`❌ **ERROR INSPECTING CAPABILITIES:** ${error instanceof Error ? error.message : String(error)}`)
1964
+ results.push("")
1965
+ results.push("💡 **Troubleshooting:**")
1966
+ results.push("• Check that MCPs are properly configured in Claude Code")
1967
+ results.push("• Verify dev3000 can access Claude cache directories")
1968
+ results.push("• Try running `discover_available_mcps()` first")
1969
+
1970
+ return {
1971
+ content: [{ type: "text", text: results.join("\n") }]
1972
+ }
1973
+ }
1974
+ }
1975
+
1475
1976
  /**
1476
1977
  * Log MCP-related events to the project-specific D3K log file (NOT main project log)
1477
1978
  * This prevents Claude from seeing dev3000's orchestration logs as application errors
@@ -1574,85 +2075,119 @@ export function calculateEstimatedTime(errorCount: number, hasIntegrations: bool
1574
2075
  }
1575
2076
 
1576
2077
  /**
1577
- * Generate Next.js specific MCP function suggestions
2078
+ * Generate dynamic Next.js specific MCP function suggestions based on discovered capabilities
1578
2079
  */
1579
- export function generateNextjsSuggestions(errorContext?: string): McpFunctionSuggestion[] {
1580
- const suggestions: McpFunctionSuggestion[] = [
1581
- {
1582
- function: "check_errors",
1583
- reason: "Analyze Next.js build and runtime errors with framework-specific context",
1584
- priority: "high"
1585
- },
1586
- {
1587
- function: "get_logs",
1588
- params: { type: "error", limit: 20 },
1589
- reason: "Retrieve detailed Next.js server logs to correlate with dev3000 findings",
1590
- priority: "high"
1591
- }
1592
- ]
2080
+ export async function generateNextjsSuggestions(errorContext?: string): Promise<McpFunctionSuggestion[]> {
2081
+ try {
2082
+ // Get dynamic capabilities from the MCP
2083
+ const capabilities = await discoverMcpCapabilities("dev3000-nextjs-dev")
2084
+
2085
+ // Filter for advanced capabilities and create suggestions
2086
+ const suggestions: McpFunctionSuggestion[] = capabilities
2087
+ .filter((cap) => cap.category === "advanced")
2088
+ .slice(0, 8) // Limit to most relevant suggestions
2089
+ .map((cap) => ({
2090
+ function: cap.function,
2091
+ reason: cap.reason,
2092
+ priority: determinePriority(cap.function, errorContext) as "high" | "medium" | "low"
2093
+ }))
2094
+
2095
+ logToDevFile(
2096
+ `Dynamic Suggestions: Generated ${suggestions.length} Next.js suggestions from ${capabilities.length} discovered capabilities`
2097
+ )
1593
2098
 
1594
- // Add context-specific suggestions
1595
- if (errorContext?.includes("hydration")) {
1596
- suggestions.push({
1597
- function: "check_hydration_errors",
1598
- reason: "Specific hydration mismatch analysis detected in error context",
1599
- priority: "high"
1600
- })
1601
- }
2099
+ return suggestions
2100
+ } catch (error) {
2101
+ logToDevFile(`Dynamic Suggestions: Failed to generate Next.js suggestions - ${error}`)
1602
2102
 
1603
- if (errorContext?.includes("build") || errorContext?.includes("compile")) {
1604
- suggestions.push({
1605
- function: "get_build_info",
1606
- reason: "Build-related errors detected, get detailed compilation information",
1607
- priority: "high"
1608
- })
2103
+ // Fallback to basic suggestions if discovery fails
2104
+ return [
2105
+ {
2106
+ function: "analyze_build_process",
2107
+ reason: "Advanced Next.js build system analysis",
2108
+ priority: "high"
2109
+ },
2110
+ {
2111
+ function: "debug_server_rendering",
2112
+ reason: "Server-side rendering debugging",
2113
+ priority: "high"
2114
+ }
2115
+ ]
1609
2116
  }
2117
+ }
1610
2118
 
1611
- return suggestions
2119
+ /**
2120
+ * Generate dynamic Chrome DevTools specific MCP function suggestions based on discovered capabilities
2121
+ */
2122
+ export async function generateChromeDevtoolsSuggestions(errorContext?: string): Promise<McpFunctionSuggestion[]> {
2123
+ try {
2124
+ // Get dynamic capabilities from the MCP
2125
+ const capabilities = await discoverMcpCapabilities("dev3000-chrome-devtools")
2126
+
2127
+ // Filter for advanced capabilities and create suggestions
2128
+ const suggestions: McpFunctionSuggestion[] = capabilities
2129
+ .filter((cap) => cap.category === "advanced")
2130
+ .slice(0, 8) // Limit to most relevant suggestions
2131
+ .map((cap) => ({
2132
+ function: cap.function,
2133
+ reason: cap.reason,
2134
+ priority: determinePriority(cap.function, errorContext) as "high" | "medium" | "low"
2135
+ }))
2136
+
2137
+ logToDevFile(
2138
+ `Dynamic Suggestions: Generated ${suggestions.length} Chrome DevTools suggestions from ${capabilities.length} discovered capabilities`
2139
+ )
2140
+
2141
+ return suggestions
2142
+ } catch (error) {
2143
+ logToDevFile(`Dynamic Suggestions: Failed to generate Chrome DevTools suggestions - ${error}`)
2144
+
2145
+ // Fallback to basic suggestions if discovery fails
2146
+ return [
2147
+ {
2148
+ function: "inspect_element",
2149
+ reason: "Deep DOM inspection with DevTools-level detail",
2150
+ priority: "high"
2151
+ },
2152
+ {
2153
+ function: "access_console",
2154
+ reason: "Direct browser console access and manipulation",
2155
+ priority: "high"
2156
+ }
2157
+ ]
2158
+ }
1612
2159
  }
1613
2160
 
1614
2161
  /**
1615
- * Generate Chrome DevTools specific MCP function suggestions
2162
+ * Determine priority of a capability based on error context and function relevance
1616
2163
  */
1617
- export function generateChromeDevtoolsSuggestions(errorContext?: string): McpFunctionSuggestion[] {
1618
- const suggestions: McpFunctionSuggestion[] = [
1619
- {
1620
- function: "list_console_messages",
1621
- params: { type: "error", limit: 20 },
1622
- reason: "Get detailed browser console errors to correlate with dev3000 interaction data",
1623
- priority: "high"
1624
- },
1625
- {
1626
- function: "list_network_requests",
1627
- params: { failed: true },
1628
- reason: "Analyze failed network requests that may be causing application errors",
1629
- priority: "medium"
1630
- },
1631
- {
1632
- function: "take_screenshot",
1633
- reason: "Capture current browser state for visual debugging",
1634
- priority: "low"
1635
- }
2164
+ function determinePriority(functionName: string, errorContext?: string): "high" | "medium" | "low" {
2165
+ const name = functionName.toLowerCase()
2166
+ const context = errorContext?.toLowerCase() || ""
2167
+
2168
+ // High priority matches - function directly relates to error context
2169
+ const highPriorityPatterns = [
2170
+ { pattern: /hydration/, keywords: ["hydration", "ssr", "render"] },
2171
+ { pattern: /build|compile/, keywords: ["build", "compile", "analyze"] },
2172
+ { pattern: /network|fetch|api/, keywords: ["network", "request", "intercept", "performance"] },
2173
+ { pattern: /console|error/, keywords: ["console", "error", "debug"] },
2174
+ { pattern: /click|interaction/, keywords: ["dom", "element", "inspect"] }
1636
2175
  ]
1637
2176
 
1638
- // Add context-specific suggestions
1639
- if (errorContext?.includes("network") || errorContext?.includes("fetch") || errorContext?.includes("api")) {
1640
- suggestions.push({
1641
- function: "get_performance_metrics",
1642
- reason: "Network-related errors detected, analyze performance and timing",
1643
- priority: "high"
1644
- })
2177
+ for (const { pattern, keywords } of highPriorityPatterns) {
2178
+ if (pattern.test(context) && keywords.some((keyword) => name.includes(keyword))) {
2179
+ return "high"
2180
+ }
1645
2181
  }
1646
2182
 
1647
- if (errorContext?.includes("click") || errorContext?.includes("interaction")) {
1648
- suggestions.push({
1649
- function: "get_dom_snapshot",
1650
- reason: "Interaction errors detected, capture DOM state for element analysis",
1651
- priority: "medium"
1652
- })
2183
+ // Medium priority - advanced debugging capabilities
2184
+ const mediumPriorityKeywords = ["debug", "profile", "analyze", "trace", "inspect"]
2185
+ if (mediumPriorityKeywords.some((keyword) => name.includes(keyword))) {
2186
+ return "medium"
1653
2187
  }
1654
2188
 
1655
- return suggestions
2189
+ // Low priority - basic or less critical functions
2190
+ return "low"
1656
2191
  }
1657
2192
 
1658
2193
  /**
@@ -1692,8 +2227,8 @@ export async function createIntegratedWorkflow({
1692
2227
  results.push("")
1693
2228
 
1694
2229
  // Generate MCP-specific suggestions
1695
- const nextjsSuggestions = integrateNextjs ? generateNextjsSuggestions(errorContext) : []
1696
- const chromeSuggestions = integrateChromeDevtools ? generateChromeDevtoolsSuggestions(errorContext) : []
2230
+ const nextjsSuggestions = integrateNextjs ? await generateNextjsSuggestions(errorContext) : []
2231
+ const chromeSuggestions = integrateChromeDevtools ? await generateChromeDevtoolsSuggestions(errorContext) : []
1697
2232
 
1698
2233
  if (!integrateNextjs && !integrateChromeDevtools) {
1699
2234
  results.push("⚠️ **NO INTEGRATIONS DETECTED**")