Chrome DevTools Protocol debugging for JavaScript/TypeScript in Chrome, Node.js, or CDP-compatible environments.
Web apps (most common):
1. launchChrome({ reference: "your-descriptive-name" }) # Auto-connects, ready immediately
2. navigate({ action: 'goto', connectionReason: "your-descriptive-name", url: "..." })
# Navigation automatically caches interactive elements (links, buttons, inputs) for the page
3. content({ action: 'findInteractive', connectionReason: "your-descriptive-name" })
# Shows summary of all interactive elements. Use search/types to filter
4. content({ action: 'extractText', mode: 'outline' }) # Read page content (preferred over screenshot)
5. Use other tools as needed with connectionReason parameter
Alternative (rename later):
1. launchChrome() # Uses default "unnamed-connection-default"
2. tab({ action: 'rename', reference: "unnamed-connection-default", newReference: "your-name" })
3. Use other tools with connectionReason: "your-name"
Node.js debugging:
1. Start app: node --inspect=9229 app.js
2. connectDebugger({ reference: "my-app-debug", port: 9229 })
3. breakpoint({ action: 'set', connectionReason: "my-app-debug", ... })
- Connect:
launchChrome({ reference: "name" })- Launches AND auto-connects (ready immediately, don't call connectDebugger)connectDebugger({ reference: "name" })- Only for existing Node.js/remote debuggers
- Navigate & interact: Use connectionReason in all tool calls
navigate({ action: 'goto', connectionReason: "name", url: "..." })input({ action: 'click', connectionReason: "name", selector: "..." })
- Debug:
breakpoint({ action: 'set', connectionReason: "name", ... }) - Inspect when paused:
inspect({ action: 'getCallStack', ... })→inspect({ action: 'getVariables', ... }) - Monitor:
console({ action: 'list', connectionReason: "name" }),network({ action: 'list', connectionReason: "name" })
Breakpoints:
- Use conditional:
setBreakpointwithcondition: "userId === '123'" - Prefer
setLogpointfor loops/high-frequency code - Clean up with
removeBreakpointor checklistBreakpoints
DOM/Event/XHR Breakpoints (Chrome only):
setDOMBreakpoint: Pause when element changessubtree-modified: Children added/removedattribute-modified: Attributes changed (class, style, etc.)node-removed: Element deleted from DOM
setEventBreakpoint: Pause when events fire (click, submit, input, keydown, etc.)setXHRBreakpoint: Pause when XHR/Fetch URL contains pattern- Example:
breakpoint({ action: 'setDOMBreakpoint', selector: '.todo-list', domBreakpointType: 'subtree-modified' }) - Note: DOM breakpoints use nodeIds which are invalidated on page reload
Code search:
searchCode: Find patternssearchFunctions: Locate definitionsgetSourceCode: View context
Modal handling:
- Use
handleModals: trueonclickElement,typeText,hoverElement - Strategies:
auto(smart),accept,reject,close,remove - Example:
clickElement({ selector: '.btn', handleModals: true, dismissStrategy: 'auto' }) - Limitation: English-only, no Shadow DOM/iframes
Multiple connections:
listConnections→switchConnection- Each connection = separate tab/process
Bug debugging:
launchChrome→navigateTosearchCode/searchFunctionssetBreakpoint/setLogpoint- Trigger bug
getCallStack+getVariablesevaluateExpression
Performance:
enableNetworkMonitoringnavigateTosearchNetworkRequests(find slow)getNetworkRequest(timing)setLogpointin slow paths
Frontend state:
querySelector+getElementPropertiesgetLocalStorage+getCookiesevaluateExpressiongetDOMSnapshot
UI verification:
content({ action: 'verify' })- Run all default checks- Reports: dead buttons, small touch targets, overflow clipping, dead links, viewport issues
- Filter checks:
checks: ['handlers', 'touch']for specific issues - Available checks:
handlers,viewport,touch,overflow,clickability,links,scroll
- After
launchChrome(): You are ALREADY connected. Do NOT callconnectDebugger(). Use thereferenceparameter when launching, or rename later withtab({ action: 'rename' }) - Interactive elements cache: Navigation (goto, reload, back, forward) automatically caches all interactive elements. Cache expires after 5 minutes.
findInteractiveshows a summary by default; usesearchortypesparameters to filter elements - Logpoint limits: Default 20 executions. Use
resetLogpointCounteror adjustmaxExecutions - Expression failures: Wrapped in try-catch, shows
[Error: message]. Search:searchConsoleLogs({pattern: "Logpoint Error"}) - CDP line mapping: May map to nearest valid line. Use
validateLogpoint()first - Source maps: Auto-handled. Use
loadSourceMapsfor manual - File paths: Full URLs (
http://localhost:3000/app.js) orfile:// - Network monitoring: Must enable with
enableNetworkMonitoring
Connection: launchChrome, killChrome, connectDebugger, disconnectDebugger, getChromeStatus, getDebuggerStatus, listConnections, switchConnection
Breakpoint: setBreakpoint, removeBreakpoint, listBreakpoints, setLogpoint, validateLogpoint, resetLogpointCounter, setDOMBreakpoint, setEventBreakpoint, setXHRBreakpoint
Execution: pause, resume, stepOver, stepInto, stepOut
Inspection: getCallStack, getVariables, evaluateExpression
Source: loadSourceMaps, searchCode, searchFunctions, getSourceCode
Console: listConsoleLogs, getConsoleLog, getRecentConsoleLogs, searchConsoleLogs, clearConsole
Network: enableNetworkMonitoring, disableNetworkMonitoring, listNetworkRequests, getNetworkRequest, searchNetworkRequests, setNetworkConditions
Page: navigateTo, reloadPage, goBack, goForward, getPageInfo
DOM: querySelector, getElementProperties, getDOMSnapshot
Content: extractText, findInteractive, verify
Screenshot: takeScreenshot, takeViewportScreenshot, takeElementScreenshot
Input: clickElement, typeText, pressKey, hoverElement
Modal: detectModals, dismissModal
Storage: getCookies, setCookie, getLocalStorage, setLocalStorage, clearStorage
Server: server (actions: start, stop, restart, list, logs, stopAll, setAutoRun, clearLogs, remove, monitorPort, unmonitorPort, listMonitored, acknowledgePort)
- Use
global: trueto access servers started from a different working directory
Replay: replay (actions: repeat, history, create, list, get, delete, export, load, listSaved, deleteSaved, run, step, finish, insert, status, cancel, recordInteraction, stopInteraction)
recordInteraction: Start recording mouse, keyboard, and navigation events with visual overlaystopInteraction: Stop recording and create sequence (uses connectionReason as default name)export: Export sequence to file - supports format: sequence/playwright/puppeteerrepeat: Instantly re-execute commands by history index -replay({ action: 'repeat', indices: [0, 1, 2] })- Each tool response shows its history index in the "Repeat" hint for easy repetition
- Use
global: truewithexportaction to save to ~/.cdp-tools/sequences/ instead of working directory
Config: config (actions: status, useLocal, useGlobal, reset, backup, cloneFromGlobal, show)
status: Show where config is loaded from (local vs global)useLocal: Switch to project-local config (.cdp-tools/config.json)useGlobal: Switch to global config (~/.cdp-tools/config.json)reset: Reset config to defaultsbackup: Create timestamped backupcloneFromGlobal: Copy global config to local projectshow: Display current configuration