Skip to content

save_pdf

Kelly Ferrone edited this page Sep 15, 2026 · 11 revisions

save_pdf

Print the current page to PDF and keep it with the session's files.

MCP tool save_pdf
HTTP POST /browser/pdf

This is the browser's own print output, so text stays selectable and the whole document is included rather than just the viewport.

Returns the stored file. Give a person its absolute_url - a link that opens in any browser and needs no bearer token, signed and time-limited when this server has a token to sign with. That is how somebody reads the PDF; nothing else in this result is any use to them. Without a public address configured the file carries a relative url.

Parameters

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

Returns

Field Type Notes
file FileEntry
bytes integer Size of the PDF in bytes.
url string Current URL after the action.
title string Page title after the action.

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

save_pdf()

HTTP

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

← All actions · Installing · Deployment

Clone this wiki locally