Skip to content

end_browser

Kelly Ferrone edited this page Sep 12, 2026 · 2 revisions

end_browser

Quit the browser and free its Grid slot. Do this when finished.

MCP tool end_browser
HTTP POST /browser/end

Ends the browser, not your session. The session keeps the browser choice and the page you were on, so a later open_session() with no arguments picks up exactly where this left off — and any files the browser had are gone with it, because the Grid keeps them per browser.

Call it on failure paths too. Browsers are scarce and an abandoned one holds a Grid slot until it is reaped. Omit session_id to end the one this client has been using.

Parameters

Name Type Required Default Notes
session_id string yes over HTTP The session_id returned by /browser/open. Required here.

Returns

Field Type Notes
success boolean
session_id string

Errors

Status Means
400 The request cannot succeed as sent — a missing field, a value that was rejected, or a locator that matched nothing before the wait ran out. Do not retry it unchanged.
401 Missing or wrong bearer token.
404 No such browser session. It ended, the Grid reaped it, or the id was never real. Open a new one and retry.
500 Something failed that this server did not expect.
503 The Grid could not serve this — unreachable, or no free slot for a new browser. Worth retrying after a wait.

Over MCP the same failures arrive as a tool error.

Example

MCP

end_browser()

HTTP

curl -X POST $SELENIUM_FLOW/browser/end \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "session_id": "…"
  }'

← All actions · Installing · Deployment

Clone this wiki locally