> ## Documentation Index
> Fetch the complete documentation index at: https://autodock.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Browser Listener

> Capture browser logs, network requests, and screenshots for AI debugging

# Browser Listener

With Autodock, you can feed logs from any browser session into your agent. Ask your agent to compare
db, server and browser logs to get a full picture of how your app is running.

<Tip>
  **Mike's notes:** At [CronRhino](https://cronrhino.io), I would regularly ask people on the sales
  and marketing team to check out my work, and I needed a way to debug their sessions remotely. This
  feature allowed me to get a complete picture of what's going on end-to-end.
</Tip>

## How It Works

The browser listener lets your AI agent capture real-time data from any browser session:

* **Console logs** - All `console.log`, `console.error`, `console.warn`, etc.
* **Network requests** - Every fetch/XHR request with method, URL, status, timing, and
  request/response bodies
* **JavaScript errors** - Uncaught exceptions and unhandled promise rejections
* **Screenshots** - On-demand page captures

## Quick Start

1. Ask your agent to start a browser listener:

```
"Start a browser listener so I can debug my webapp"
```

2. Your agent will call `browser.listen` and give you a command to paste in your browser console:

```javascript theme={null}
fetch('https://autodock.io/b/xK9mZ2')
  .then((r) => r.text())
  .then(eval);
```

3. Paste the command in your browser's developer console (F12 or Cmd+Option+I)

4. You'll see `[autodock] Listening...` in your console - the listener is now active

5. Your agent can now poll for events and request screenshots

## MCP Tools

### browser.listen

Creates a new browser listener session.

**Parameters:**

* `ttlMinutes` (optional): Session timeout in minutes (5-60, default: 30)

**Returns:**

* `token`: 6-character session token
* `consoleCommand`: The command to paste in browser console
* `expiresAt`: When the session expires

### browser.poll

Retrieves captured browser events.

**Parameters:**

* `token`: The 6-character session token
* `limit` (optional): Maximum events to retrieve (1-100, default: 50)
* `sinceMinutes` (optional): Only return events from the last N minutes (1-60, default: 5)

**Returns:**

* Console logs, network requests, and errors with timestamps
* Screenshot URL if one was captured
* Session status

### browser.shot

Requests a screenshot from the browser.

**Parameters:**

* `token`: The 6-character session token

**Note:** Screenshots take 10-15 seconds to capture. Call `browser.poll` after waiting to retrieve
the screenshot URL.

### browser.stop

Stops a listener session and cleans up resources.

**Parameters:**

* `token`: The 6-character session token

## Example Session

```
User: There's a bug on my checkout page. Can you help debug?

Agent: I'll start a browser listener to capture what's happening.
       [calls browser.listen]

       Paste this in your browser console:
       fetch('https://autodock.io/b/xK9mZ2').then(r=>r.text()).then(eval)

       Let me know when you've done that and triggered the bug.

User: Done! I clicked "Place Order" and it failed.

Agent: [calls browser.poll]

       I can see the issue:
       [12:34:56] ERROR Cannot read property 'id' of undefined
       [12:34:56] NET POST /api/orders -> 500 (142ms)
                  REQ: {"items":[]}
                  RES: {"error":"Cart is empty"}

       The order is failing because the cart items array is empty when
       you click Place Order. Let me check your cart state management...
```

## Stopping the Listener

From the browser console:

```javascript theme={null}
autodock.stop();
```

Or ask your agent to stop it, which will call `browser.stop`.

## Privacy & Security

* Sessions expire after 30 minutes by default (configurable up to 60 minutes)
* Sensitive data like passwords, tokens, and auth headers are automatically redacted
* Request/response bodies are truncated to 2000 characters
* Screenshots are stored temporarily (5 minutes) and then deleted
* Each session is isolated to the user who created it
