@eddym06/custom-chrome-mcp 1.0.8 → 1.2.0

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 (174) hide show
  1. package/.npmrc-github +2 -0
  2. package/ANALISIS_PROBLEMAS.md +189 -0
  3. package/Backup Original/.npmrc-github +2 -0
  4. package/Backup Original/CHANGELOG.md +87 -0
  5. package/Backup Original/CONDITIONAL_DESCRIPTIONS.md +174 -0
  6. package/Backup Original/FUTURE_FEATURES.txt +1503 -0
  7. package/Backup Original/HERRAMIENTAS_VERIFICADAS.md +201 -0
  8. package/Backup Original/INSTALL.md +148 -0
  9. package/Backup Original/LICENSE +21 -0
  10. package/Backup Original/NETWORK_FREEZE_FIX.md +206 -0
  11. package/Backup Original/OPTIMIZACION_PARA_IA.txt +219 -0
  12. package/Backup Original/README.md +700 -0
  13. package/Backup Original/TEST_WORKFLOW.md +311 -0
  14. package/Backup Original/USAGE_GUIDE.md +393 -0
  15. package/Backup Original/demo_features.ts +115 -0
  16. package/Backup Original/dist/chrome-connector.d.ts +143 -0
  17. package/Backup Original/dist/chrome-connector.d.ts.map +1 -0
  18. package/Backup Original/dist/chrome-connector.js +812 -0
  19. package/Backup Original/dist/chrome-connector.js.map +1 -0
  20. package/Backup Original/dist/index.d.ts +7 -0
  21. package/Backup Original/dist/index.d.ts.map +1 -0
  22. package/Backup Original/dist/index.js +270 -0
  23. package/Backup Original/dist/index.js.map +1 -0
  24. package/Backup Original/dist/tests/execute-script-tests.d.ts +62 -0
  25. package/Backup Original/dist/tests/execute-script-tests.d.ts.map +1 -0
  26. package/Backup Original/dist/tests/execute-script-tests.js +280 -0
  27. package/Backup Original/dist/tests/execute-script-tests.js.map +1 -0
  28. package/Backup Original/dist/tests/run-execute-tests.d.ts +7 -0
  29. package/Backup Original/dist/tests/run-execute-tests.d.ts.map +1 -0
  30. package/Backup Original/dist/tests/run-execute-tests.js +88 -0
  31. package/Backup Original/dist/tests/run-execute-tests.js.map +1 -0
  32. package/Backup Original/dist/tools/advanced-network.backup.d.ts +245 -0
  33. package/Backup Original/dist/tools/advanced-network.backup.d.ts.map +1 -0
  34. package/Backup Original/dist/tools/advanced-network.backup.js +996 -0
  35. package/Backup Original/dist/tools/advanced-network.backup.js.map +1 -0
  36. package/Backup Original/dist/tools/advanced-network.d.ts +152 -0
  37. package/Backup Original/dist/tools/advanced-network.d.ts.map +1 -0
  38. package/Backup Original/dist/tools/advanced-network.js +1379 -0
  39. package/Backup Original/dist/tools/advanced-network.js.map +1 -0
  40. package/Backup Original/dist/tools/anti-detection.d.ts +22 -0
  41. package/Backup Original/dist/tools/anti-detection.d.ts.map +1 -0
  42. package/Backup Original/dist/tools/anti-detection.js +225 -0
  43. package/Backup Original/dist/tools/anti-detection.js.map +1 -0
  44. package/Backup Original/dist/tools/capture.d.ts +136 -0
  45. package/Backup Original/dist/tools/capture.d.ts.map +1 -0
  46. package/Backup Original/dist/tools/capture.js +217 -0
  47. package/Backup Original/dist/tools/capture.js.map +1 -0
  48. package/Backup Original/dist/tools/interaction.d.ts +102 -0
  49. package/Backup Original/dist/tools/interaction.d.ts.map +1 -0
  50. package/Backup Original/dist/tools/interaction.js +222 -0
  51. package/Backup Original/dist/tools/interaction.js.map +1 -0
  52. package/Backup Original/dist/tools/navigation.d.ts +109 -0
  53. package/Backup Original/dist/tools/navigation.d.ts.map +1 -0
  54. package/Backup Original/dist/tools/navigation.js +210 -0
  55. package/Backup Original/dist/tools/navigation.js.map +1 -0
  56. package/Backup Original/dist/tools/network-accessibility.d.ts +40 -0
  57. package/Backup Original/dist/tools/network-accessibility.d.ts.map +1 -0
  58. package/Backup Original/dist/tools/network-accessibility.js +557 -0
  59. package/Backup Original/dist/tools/network-accessibility.js.map +1 -0
  60. package/Backup Original/dist/tools/playwright-launcher.d.ts +53 -0
  61. package/Backup Original/dist/tools/playwright-launcher.d.ts.map +1 -0
  62. package/Backup Original/dist/tools/playwright-launcher.js +117 -0
  63. package/Backup Original/dist/tools/playwright-launcher.js.map +1 -0
  64. package/Backup Original/dist/tools/service-worker.d.ts +128 -0
  65. package/Backup Original/dist/tools/service-worker.d.ts.map +1 -0
  66. package/Backup Original/dist/tools/service-worker.js +365 -0
  67. package/Backup Original/dist/tools/service-worker.js.map +1 -0
  68. package/Backup Original/dist/tools/session.d.ts +54 -0
  69. package/Backup Original/dist/tools/session.d.ts.map +1 -0
  70. package/Backup Original/dist/tools/session.js +329 -0
  71. package/Backup Original/dist/tools/session.js.map +1 -0
  72. package/Backup Original/dist/tools/system.d.ts +159 -0
  73. package/Backup Original/dist/tools/system.d.ts.map +1 -0
  74. package/Backup Original/dist/tools/system.js +256 -0
  75. package/Backup Original/dist/tools/system.js.map +1 -0
  76. package/Backup Original/dist/types/index.d.ts +75 -0
  77. package/Backup Original/dist/types/index.d.ts.map +1 -0
  78. package/Backup Original/dist/types/index.js +5 -0
  79. package/Backup Original/dist/types/index.js.map +1 -0
  80. package/Backup Original/dist/utils/helpers.d.ts +57 -0
  81. package/Backup Original/dist/utils/helpers.d.ts.map +1 -0
  82. package/Backup Original/dist/utils/helpers.js +142 -0
  83. package/Backup Original/dist/utils/helpers.js.map +1 -0
  84. package/Backup Original/dist/utils/truncate.d.ts +29 -0
  85. package/Backup Original/dist/utils/truncate.d.ts.map +1 -0
  86. package/Backup Original/dist/utils/truncate.js +46 -0
  87. package/Backup Original/dist/utils/truncate.js.map +1 -0
  88. package/Backup Original/dist/verify-tools.d.ts +7 -0
  89. package/Backup Original/dist/verify-tools.d.ts.map +1 -0
  90. package/Backup Original/dist/verify-tools.js +137 -0
  91. package/Backup Original/dist/verify-tools.js.map +1 -0
  92. package/Backup Original/list-tools.js +127 -0
  93. package/Backup Original/mcp-config-example.json +12 -0
  94. package/Backup Original/package-lock.json +2666 -0
  95. package/Backup Original/package.json +65 -0
  96. package/Backup Original/recordings/demo_recording.har +3036 -0
  97. package/CONDITIONAL_DESCRIPTIONS.md +174 -0
  98. package/FUTURE_FEATURES.txt +1503 -0
  99. package/HERRAMIENTAS_VERIFICADAS.md +201 -0
  100. package/IMPLEMENTACION_COMPLETADA.md +298 -0
  101. package/LIMITACIONES_REPLAY.md +204 -0
  102. package/NETWORK_FREEZE_FIX.md +206 -0
  103. package/NUEVO_WORKFLOW.md +319 -0
  104. package/OPTIMIZACION_PARA_IA.txt +219 -0
  105. package/PLAYWRIGHT_VS_CDP.md +262 -0
  106. package/README.md +300 -3
  107. package/TEST_WORKFLOW.md +311 -0
  108. package/USAGE_GUIDE.md +393 -0
  109. package/WORKFLOW_GUIDE.md +240 -0
  110. package/demo_features.ts +115 -0
  111. package/dist/chrome-connector.d.ts +10 -0
  112. package/dist/chrome-connector.d.ts.map +1 -1
  113. package/dist/chrome-connector.js +44 -0
  114. package/dist/chrome-connector.js.map +1 -1
  115. package/dist/index.js +142 -21
  116. package/dist/index.js.map +1 -1
  117. package/dist/tests/execute-script-tests.d.ts +62 -0
  118. package/dist/tests/execute-script-tests.d.ts.map +1 -0
  119. package/dist/tests/execute-script-tests.js +280 -0
  120. package/dist/tests/execute-script-tests.js.map +1 -0
  121. package/dist/tests/run-execute-tests.d.ts +7 -0
  122. package/dist/tests/run-execute-tests.d.ts.map +1 -0
  123. package/dist/tests/run-execute-tests.js +88 -0
  124. package/dist/tests/run-execute-tests.js.map +1 -0
  125. package/dist/tools/advanced-network.backup.d.ts +245 -0
  126. package/dist/tools/advanced-network.backup.d.ts.map +1 -0
  127. package/dist/tools/advanced-network.backup.js +996 -0
  128. package/dist/tools/advanced-network.backup.js.map +1 -0
  129. package/dist/tools/advanced-network.d.ts +152 -0
  130. package/dist/tools/advanced-network.d.ts.map +1 -0
  131. package/dist/tools/advanced-network.js +1379 -0
  132. package/dist/tools/advanced-network.js.map +1 -0
  133. package/dist/tools/anti-detection.js +5 -5
  134. package/dist/tools/anti-detection.js.map +1 -1
  135. package/dist/tools/capture.d.ts +7 -1
  136. package/dist/tools/capture.d.ts.map +1 -1
  137. package/dist/tools/capture.js +60 -12
  138. package/dist/tools/capture.js.map +1 -1
  139. package/dist/tools/interaction.d.ts +52 -73
  140. package/dist/tools/interaction.d.ts.map +1 -1
  141. package/dist/tools/interaction.js +181 -236
  142. package/dist/tools/interaction.js.map +1 -1
  143. package/dist/tools/navigation.d.ts +58 -31
  144. package/dist/tools/navigation.d.ts.map +1 -1
  145. package/dist/tools/navigation.js +169 -181
  146. package/dist/tools/navigation.js.map +1 -1
  147. package/dist/tools/network-accessibility.d.ts +40 -0
  148. package/dist/tools/network-accessibility.d.ts.map +1 -0
  149. package/dist/tools/network-accessibility.js +567 -0
  150. package/dist/tools/network-accessibility.js.map +1 -0
  151. package/dist/tools/playwright-launcher.js +4 -4
  152. package/dist/tools/playwright-launcher.js.map +1 -1
  153. package/dist/tools/service-worker.js +10 -10
  154. package/dist/tools/service-worker.js.map +1 -1
  155. package/dist/tools/session.d.ts.map +1 -1
  156. package/dist/tools/session.js +20 -11
  157. package/dist/tools/session.js.map +1 -1
  158. package/dist/tools/smart-workflows.d.ts +806 -0
  159. package/dist/tools/smart-workflows.d.ts.map +1 -0
  160. package/dist/tools/smart-workflows.js +1191 -0
  161. package/dist/tools/smart-workflows.js.map +1 -0
  162. package/dist/tools/system.js +3 -3
  163. package/dist/tools/system.js.map +1 -1
  164. package/dist/utils/truncate.d.ts +29 -0
  165. package/dist/utils/truncate.d.ts.map +1 -0
  166. package/dist/utils/truncate.js +46 -0
  167. package/dist/utils/truncate.js.map +1 -0
  168. package/dist/verify-tools.d.ts +7 -0
  169. package/dist/verify-tools.d.ts.map +1 -0
  170. package/dist/verify-tools.js +137 -0
  171. package/dist/verify-tools.js.map +1 -0
  172. package/list-tools.js +127 -0
  173. package/package.json +65 -64
  174. package/recordings/demo_recording.har +3036 -0
package/.npmrc-github ADDED
@@ -0,0 +1,2 @@
1
+ @eddym06:registry=https://npm.pkg.github.com
2
+ //npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
@@ -0,0 +1,189 @@
1
+ # 📊 Análisis de Problemas Detectados
2
+
3
+ ## 🔴 Problema 1: El sistema de activación no funciona
4
+
5
+ ### Causa Raíz
6
+ El protocolo MCP **NO actualiza automáticamente** la lista de herramientas después de que el servidor envía una respuesta. Cuando la IA inicia:
7
+
8
+ 1. **Primera petición**: Cliente pide lista de tools → Recibe 39 herramientas (core + control)
9
+ 2. **Llamada a activación**: IA llama `show_advanced_tools` → Server cambia flag `advancedToolsEnabled = true`
10
+ 3. **❌ PROBLEMA**: Cliente NO sabe que debe pedir la lista de nuevo
11
+ 4. **Resultado**: IA sigue trabajando con lista antigua de 39 tools
12
+ 5. **Síntoma**: IA dice "resend_network_request no está disponible" aunque el server lo activó
13
+
14
+ ### Solución Implementada: Notificaciones MCP
15
+
16
+ ```typescript
17
+ // 1. Habilitar capability en el servidor
18
+ capabilities: {
19
+ tools: {
20
+ listChanged: true, // ✅ Indica que el servidor soporta notificar cambios
21
+ },
22
+ }
23
+
24
+ // 2. Enviar notificación cuando cambia la lista
25
+ await server.notification({
26
+ method: 'notifications/tools/list_changed',
27
+ params: {}
28
+ });
29
+ ```
30
+
31
+ **Flujo corregido:**
32
+ 1. Cliente pide lista → 39 tools
33
+ 2. IA llama `show_advanced_tools`
34
+ 3. Server cambia flag + **ENVÍA NOTIFICACIÓN** 🔔
35
+ 4. Cliente recibe notificación → **Vuelve a pedir lista automáticamente**
36
+ 5. Cliente recibe nueva lista → 89 tools (39 core + 50 advanced)
37
+ 6. ✅ IA ahora puede ver y usar `resend_network_request`
38
+
39
+ ---
40
+
41
+ ## 🔴 Problema 2: `test_api_endpoint` fallaba con headers
42
+
43
+ ### Lo que pasó en el test de Copilot:
44
+
45
+ ```javascript
46
+ // ❌ Copilot intentó pasar headers como STRING JSON
47
+ test_api_endpoint({
48
+ url: "https://www.apple.com/search-services/suggestions/",
49
+ method: "POST",
50
+ body: "{...}",
51
+ headers: "{\"Content-Type\": \"application/json\"}" // ❌ STRING
52
+ })
53
+
54
+ // Error: El código esperaba un OBJETO
55
+ const headersObj = headers || {}; // ❌ Si headers es string, falla
56
+ ```
57
+
58
+ ### Causa Raíz
59
+ El schema Zod solo aceptaba objetos:
60
+
61
+ ```typescript
62
+ // ❌ ANTES
63
+ headers: z.record(z.string()).optional()
64
+
65
+ // ✅ AHORA
66
+ headers: z.union([z.record(z.string()), z.string()]).optional()
67
+ ```
68
+
69
+ ### Solución Implementada
70
+
71
+ ```typescript
72
+ // Parse automático en el handler
73
+ let headersObj = {};
74
+ if (headers) {
75
+ if (typeof headers === 'string') {
76
+ try {
77
+ headersObj = JSON.parse(headers); // Convierte string a objeto
78
+ } catch (e) {
79
+ throw new Error(`Invalid headers JSON string: ${e.message}`);
80
+ }
81
+ } else {
82
+ headersObj = headers; // Ya es objeto
83
+ }
84
+ }
85
+ ```
86
+
87
+ **Ahora acepta ambos formatos:**
88
+ - ✅ `headers: { "Content-Type": "application/json" }` (objeto)
89
+ - ✅ `headers: "{\"Content-Type\": \"application/json\"}"` (string JSON)
90
+
91
+ ---
92
+
93
+ ## 📈 Impacto de las Correcciones
94
+
95
+ ### Antes:
96
+ - ❌ Sistema de activación no funcionaba (notificaciones no implementadas)
97
+ - ❌ `test_api_endpoint` fallaba si la IA pasaba strings
98
+ - ❌ IA usaba `execute_script` + `fetch()` como fallback (bloqueado por validación)
99
+ - ❌ IA no podía completar el workflow
100
+
101
+ ### Ahora:
102
+ - ✅ Sistema de activación funcional con notificaciones MCP estándar
103
+ - ✅ `test_api_endpoint` acepta headers/body flexibles
104
+ - ✅ Cliente recibe actualización automática de lista de tools
105
+ - ✅ IA puede descubrir y usar `resend_network_request` correctamente
106
+
107
+ ---
108
+
109
+ ## 🧪 Próxima Prueba
110
+
111
+ Repetir el mismo test con Copilot:
112
+
113
+ ```
114
+ Navega a apple.com, luego presiona un botón e intercepta el tráfico de red,
115
+ y que manda ese paquete, luego vuelve a la página inicial, y ejecuta el
116
+ paquete que interceptaste y mándaselo a la página ver qué hace
117
+ ```
118
+
119
+ **Resultado esperado:**
120
+ 1. ✅ `capture_network_on_action` captura el requestId
121
+ 2. ✅ `show_advanced_tools` activa y notifica
122
+ 3. ✅ Cliente actualiza lista automáticamente
123
+ 4. ✅ `resend_network_request` ahora visible y usable
124
+ 5. ✅ Workflow completo exitoso
125
+
126
+ ---
127
+
128
+ ## 🔧 Cambios Técnicos Aplicados
129
+
130
+ ### `src/index.ts`
131
+ ```typescript
132
+ // ✅ Agregado: capabilities.tools.listChanged
133
+ capabilities: {
134
+ tools: {
135
+ listChanged: true,
136
+ },
137
+ }
138
+
139
+ // ✅ Agregado: Notificación en show_advanced_tools
140
+ await server.notification({
141
+ method: 'notifications/tools/list_changed',
142
+ params: {}
143
+ });
144
+
145
+ // ✅ Agregado: Notificación en hide_advanced_tools
146
+ await server.notification({
147
+ method: 'notifications/tools/list_changed',
148
+ params: {}
149
+ });
150
+ ```
151
+
152
+ ### `src/tools/smart-workflows.ts`
153
+ ```typescript
154
+ // ✅ Schema flexible para headers
155
+ inputSchema: z.object({
156
+ headers: z.union([z.record(z.string()), z.string()]).optional(),
157
+ // ...
158
+ })
159
+
160
+ // ✅ Parser automático en handler
161
+ let headersObj = {};
162
+ if (headers) {
163
+ if (typeof headers === 'string') {
164
+ headersObj = JSON.parse(headers);
165
+ } else {
166
+ headersObj = headers;
167
+ }
168
+ }
169
+ ```
170
+
171
+ ---
172
+
173
+ ## 📚 Referencias MCP
174
+
175
+ - **Spec oficial**: `notifications/tools/list_changed` es una notificación estándar del protocolo MCP
176
+ - **Capability**: `tools.listChanged: true` debe estar en `ServerCapabilities`
177
+ - **Método**: `server.notification()` para enviar notificaciones al cliente
178
+ - **Tipo**: `ToolListChangedNotification` con `params?: NotificationParams`
179
+
180
+ ---
181
+
182
+ ## ✅ Estado del Sistema
183
+
184
+ **Compilación**: ✅ Exitosa
185
+ **Notificaciones MCP**: ✅ Implementadas
186
+ **Flexibilidad de inputs**: ✅ Mejorada
187
+ **Listo para prueba**: ✅ SÍ
188
+
189
+ Siguiente paso: **Prueba real con Copilot** para validar que el sistema de notificaciones funciona correctamente.
@@ -0,0 +1,2 @@
1
+ @eddym06:registry=https://npm.pkg.github.com
2
+ //npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
@@ -0,0 +1,87 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [1.0.0] - 2026-01-07
6
+
7
+ ### ✨ Features
8
+
9
+ #### Core
10
+ - Initial release of Custom Chrome MCP
11
+ - Connect to existing Chrome instances via CDP (port 9222)
12
+ - Full MCP protocol implementation with 44 tools
13
+
14
+ #### Navigation & Tabs (8 tools)
15
+ - Navigate to URLs with wait conditions
16
+ - Browser history (back/forward)
17
+ - Page reload with cache options
18
+ - Multi-tab management (list, create, close, switch)
19
+ - Get current URL and page info
20
+
21
+ #### Interaction (8 tools)
22
+ - Click elements with human-like delays
23
+ - Type text with realistic timing
24
+ - Get text content and attributes
25
+ - Execute custom JavaScript
26
+ - Scroll pages and elements
27
+ - Wait for selectors with timeout
28
+ - Select options from dropdowns
29
+
30
+ #### Anti-Detection (5 tools)
31
+ - Stealth mode with navigator.webdriver masking
32
+ - Custom user agent configuration
33
+ - Viewport and device emulation
34
+ - Geolocation spoofing
35
+ - Timezone override
36
+
37
+ #### Service Workers (9 tools)
38
+ - List all registered service workers
39
+ - Get detailed worker information
40
+ - Unregister service workers
41
+ - Force update registrations
42
+ - Start/stop workers
43
+ - Inspect workers in DevTools
44
+ - Skip waiting phase
45
+ - Manage service worker caches
46
+
47
+ #### Capture & Export (5 tools)
48
+ - Screenshots (PNG/JPEG, full page, custom areas)
49
+ - Export to PDF
50
+ - Get HTML content
51
+ - Page layout metrics
52
+ - Accessibility tree export
53
+
54
+ #### Sessions & Cookies (9 tools)
55
+ - Cookie management (get, set, delete, clear)
56
+ - localStorage operations
57
+ - sessionStorage support
58
+ - Full session export/import
59
+ - Cross-session persistence
60
+
61
+ ### 🛡️ Security
62
+ - Anti-detection measures
63
+ - Realistic browser fingerprinting
64
+ - Human-like interaction patterns
65
+
66
+ ### 📚 Documentation
67
+ - Comprehensive README
68
+ - Usage examples
69
+ - Troubleshooting guide
70
+ - API documentation
71
+
72
+ ### 🔧 Technical
73
+ - TypeScript implementation
74
+ - Zod schema validation
75
+ - Error handling
76
+ - Graceful shutdown
77
+ - Modular architecture
78
+
79
+ ## [Unreleased]
80
+
81
+ ### Planned Features
82
+ - Visual regression testing
83
+ - Network throttling
84
+ - Performance profiling
85
+ - Video recording
86
+ - Auto-recovery mechanisms
87
+ - Multi-profile support (future)
@@ -0,0 +1,174 @@
1
+ # Conditional Description Patterns for All Tools
2
+
3
+ ## Philosophy: "When to Use" > "What it Does"
4
+
5
+ AI models make better tool selection decisions when descriptions focus on **triggers** and **context** rather than just functionality.
6
+
7
+ ---
8
+
9
+ ## Pattern Templates
10
+
11
+ ### Pattern 1: Navigation Tools
12
+ ```
13
+ [Tool Name] - [Primary Action]
14
+
15
+ USE THIS WHEN:
16
+ - User says "[trigger phrase 1]"
17
+ - User says "[trigger phrase 2]"
18
+ - [Contextual condition]
19
+
20
+ WORKFLOW:
21
+ 1️⃣ [This tool] → 2️⃣ [Next logical step] → 3️⃣ [Then action]
22
+
23
+ ❌ DO NOT USE when [anti-pattern]
24
+ ✅ USE when [correct pattern]
25
+ ```
26
+
27
+ ### Pattern 2: Interaction Tools
28
+ ```
29
+ [Tool Name] - [Primary Action]
30
+
31
+ ⚠️ PREREQUISITE: [Required step before this tool]
32
+
33
+ USE THIS WHEN:
34
+ - [User intent 1]
35
+ - [User intent 2]
36
+
37
+ PROPER WORKFLOW:
38
+ 1️⃣ [Analysis step] → 2️⃣ [This tool] → 3️⃣ [Verification]
39
+
40
+ COMMON MISTAKE: [What AI typically gets wrong]
41
+ ```
42
+
43
+ ### Pattern 3: Analysis/Inspection Tools
44
+ ```
45
+ [Tool Name] - [Primary Action]
46
+
47
+ 🔍 USE THIS WHEN:
48
+ - [Symptom 1] (e.g., "content missing after click")
49
+ - [Symptom 2] (e.g., "page loads but data empty")
50
+ - [Symptom 3]
51
+
52
+ WHY CRITICAL: [Explains the "why" - what's invisible without this tool]
53
+
54
+ WHEN NOT TO USE: [Situations where simpler tool suffices]
55
+ ```
56
+
57
+ ### Pattern 4: Network/Debugging Tools
58
+ ```
59
+ [Tool Name] - [Primary Action]
60
+
61
+ 🚨 USE THIS WHEN:
62
+ - After [action], expected [result] doesn't appear
63
+ - Suspecting [technical condition]
64
+ - Need to [specific diagnostic]
65
+
66
+ WORKFLOW STEP: [X] of [Y]
67
+ PREVIOUS: [What should have been done before]
68
+ NEXT: [What to do after]
69
+
70
+ TROUBLESHOOTING: If [problem], this tool reveals [hidden information]
71
+ ```
72
+
73
+ ### Pattern 5: Configuration/Setup Tools
74
+ ```
75
+ [Tool Name] - [Primary Action]
76
+
77
+ ⚙️ CONFIGURE BEFORE: [Type of operation]
78
+
79
+ PARAMETERS AI SHOULD SET:
80
+ - [param1]: [guidance on value selection]
81
+ - [param2]: [guidance on value selection]
82
+
83
+ TYPICAL VALUES:
84
+ - Simple operations: [value]
85
+ - Complex operations: [value]
86
+ - Heavy operations: [value]
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Application Strategy
92
+
93
+ ### Phase 1: Critical Path Tools (HIGH PRIORITY)
94
+ Tools that are most commonly used and most likely to be misused:
95
+ - ✅ navigate (DONE)
96
+ - ✅ create_tab (DONE)
97
+ - ✅ click (DONE)
98
+ - ✅ type (DONE)
99
+ - ✅ get_html (DONE)
100
+ - ✅ screenshot (DONE)
101
+ - ✅ execute_script (DONE)
102
+ - ✅ enable_response_interception (DONE)
103
+ - ✅ list_intercepted_responses (DONE)
104
+
105
+ ### Phase 2: Analysis & Debugging (MEDIUM PRIORITY)
106
+ - get_text
107
+ - get_attribute
108
+ - wait_for_selector
109
+ - list_tabs
110
+ - get_url
111
+ - get_cookies
112
+ - list_all_targets
113
+ - connect_to_target
114
+ - execute_in_target
115
+
116
+ ### Phase 3: Advanced Network (MEDIUM PRIORITY)
117
+ - modify_intercepted_response (partially done)
118
+ - create_mock_endpoint
119
+ - enable_websocket_interception
120
+ - start_har_recording
121
+ - export_har_file
122
+ - inject_css_global
123
+ - inject_js_global
124
+
125
+ ### Phase 4: Specialized Tools (LOWER PRIORITY)
126
+ - Anti-detection tools
127
+ - Service worker tools
128
+ - Session management
129
+ - Print to PDF
130
+ - Storage tools
131
+
132
+ ---
133
+
134
+ ## Key Principles
135
+
136
+ 1. **Start with "WHEN"**: What triggers using this tool?
137
+ 2. **Explain "WHY"**: What's invisible/unclear without it?
138
+ 3. **Show "HOW"**: What's the workflow?
139
+ 4. **Warn against anti-patterns**: What mistakes do AIs make?
140
+ 5. **Guide parameters**: What values should AI choose?
141
+
142
+ ---
143
+
144
+ ## Examples Applied
145
+
146
+ ### Before (generic):
147
+ ```typescript
148
+ name: 'get_cookies',
149
+ description: 'Get all cookies for the current domain'
150
+ ```
151
+
152
+ ### After (conditional):
153
+ ```typescript
154
+ name: 'get_cookies',
155
+ description: `🔍 Retrieves browser cookies for current domain.
156
+
157
+ USE THIS WHEN:
158
+ - Debugging authentication issues (checking if auth token exists)
159
+ - Session not persisting (verify session cookies)
160
+ - Login appears successful but features unavailable (check cookie values)
161
+ - Need to verify third-party cookies loaded
162
+
163
+ WHY: Cookies often contain hidden auth/session data not visible in HTML.
164
+ Many login/auth issues are cookie-related (expired, wrong domain, httpOnly).
165
+
166
+ COMMON ISSUES DIAGNOSED:
167
+ - "User logged in but still see login page" → Check auth cookie
168
+ - "Cart items disappear" → Check session cookie
169
+ - "Preferences not saving" → Check settings cookie`
170
+ ```
171
+
172
+ ---
173
+
174
+ This pattern should be applied to ALL 84+ tools systematically.