Attach to a running browser
use_running_browserAttach to an already running Chrome to control your signed-in browser session without launching a new instance. Preserves real logins by connecting to the existing process.
Instructions
Drive a Chrome that is already running, instead of launching a new one.
This is how you use a browser you are already signed into. Chrome locks its user-data-dir, so the profile holding your real logins cannot be opened a second time — attaching to the running instance is the only way in, and it saves rebuilding every login through the automation.
The user starts Chrome themselves, once:
chrome --remote-debugging-port=9222 --user-data-dir=/path/to/profilethen this tool attaches to it. Every tool then acts on that browser and its real tabs.
--user-data-dir is not optional, and it must not be Chrome's own default
directory. Since Chrome 136 the port is refused there — Chrome starts
normally, says nothing, and nothing ever listens, which is a confusing way
to fail. So the everyday profile cannot be reached by adding the flag to
it; it has to be a directory of its own, and a copy of an existing profile
is accepted (--profile-directory then picks which profile inside it).
SECURITY: that profile becomes part of the agent's reach. Whatever it is signed into — mail, bank, company systems — is reachable from here, because a cookie jar is all or nothing. Point this at a profile you are willing to expose, not your everyday one.
While attached, close_browser and every profile switch only detach; they never close a browser they did not start. Return to a self-launched browser with use_temp_profile or use_profile.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host | No | Host the browser is listening on. Leave at 127.0.0.1 unless you are attaching to a browser on another machine or in a container. | 127.0.0.1 |
| port | No | The remote debugging port Chrome was started with, e.g. 9222 for --remote-debugging-port=9222. | |
| browser | No | Which browser to act on. Each name is an independent Chrome, created on first use. Omit for the shared default; parallel agents each need their own name. | default |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |