Debug Webapp Skill
Systematic debugging workflow for the trading-webapp frontend using Chrome DevTools MCP.
Prerequisites
- •Chrome browser open with the webapp loaded
- •Chrome DevTools MCP server running
Step 1: Get Current State
Take Page Snapshot
code
mcp__chrome-devtools__take_snapshot
This shows the current page structure and identifies interactive elements.
List Open Pages
code
mcp__chrome-devtools__list_pages
Identify which page/tab to debug. Use select_page if needed.
Step 2: Check for Errors
Console Errors
code
mcp__chrome-devtools__list_console_messages - Filter by types: ["error", "warn"]
Look for:
- •JavaScript errors
- •React errors (component stack traces)
- •WebSocket connection failures
- •API response errors logged by the app
Get Details on Specific Error
code
mcp__chrome-devtools__get_console_message - msgid: <from list above>
Step 3: Network Analysis
List Network Requests
code
mcp__chrome-devtools__list_network_requests - resourceTypes: ["fetch", "xhr", "websocket"]
Look for:
- •Failed requests (4xx, 5xx status)
- •Slow requests
- •WebSocket disconnections
- •Missing CORS headers
Inspect Specific Request
code
mcp__chrome-devtools__get_network_request - reqid: <from list above>
Check:
- •Request headers (auth tokens present?)
- •Response body (error messages?)
- •Timing (slow backend?)
Step 4: Interactive Debugging
Evaluate JavaScript
code
mcp__chrome-devtools__evaluate_script
- function: "() => { return window.__APP_STATE__ }"
Useful checks:
- •
() => localStorage.getItem('auth_token') - •
() => document.querySelectorAll('[data-error]').length - •
() => window.__WEBSOCKET_STATE__
Take Screenshot
code
mcp__chrome-devtools__take_screenshot - fullPage: true (for full page) - uid: <element> (for specific component)
Step 5: Performance (if needed)
Start Performance Trace
code
mcp__chrome-devtools__performance_start_trace - reload: true - autoStop: true
Analyze Performance Insights
code
mcp__chrome-devtools__performance_analyze_insight - insightSetId: <from trace> - insightName: "LCPBreakdown" or "DocumentLatency"
Common Issues & Checks
WebSocket Not Connecting
- •Check console for WebSocket errors
- •Check network for WS connection attempts
- •Verify backend is running:
curl http://localhost:8000/health - •Check CORS configuration
Chart Not Rendering
- •Take screenshot of chart container
- •Check console for TradingView errors
- •Verify data is being received (network tab)
- •Check element visibility in snapshot
API Calls Failing
- •List network requests filtered to fetch/xhr
- •Check request headers (Authorization present?)
- •Check response status and body
- •Verify backend endpoint exists
State Not Updating
- •Evaluate script to check React state/context
- •Check for console errors during action
- •Verify WebSocket messages arriving (network tab)
Quick Debug Sequence
For most issues, run this sequence:
- •
list_pages→ identify the page - •
take_snapshot→ see current UI state - •
list_console_messages(errors only) → find JS errors - •
list_network_requests(fetch/xhr/websocket) → find API issues - •
take_screenshot→ visual confirmation
Then dig deeper based on what you find.
Webapp-Specific Locations
| Component | What to Check |
|---|---|
| Scanner table | WebSocket messages, /api/candidates |
| TradingView chart | tradingview console logs, symbol data feed |
| Watchlist | /api/watchlist endpoint, localStorage |
| Trade panel | /api/orders, form validation errors |
| Journal | /api/journal, DecisionSnapshot format |