keep_file - kubed-io/selenium-flow GitHub Wiki

keep_file

Moves a screenshot or a recording into Files, or copies a download there.

MCP tool keep_file
HTTP PUT /files/{folder}/{name}/kept

The folder and name are both in the path โ€” a screenshot moves out of its folder, a download is copied because the Grid offers no way to remove one file. A clash with a name already in Files lands beside it as name (1) for a screenshot; a download REPLACES it.

Parameters

Name Type Required Default
folder string yes โ€”
name string yes โ€”

Every call names its workspace: an X-Workspace header, or ?workspace=<name>. Sending both is refused. See Workspaces.

Returns

Field Type Notes
kept boolean
from string The uri it was kept from.
uri string Its new address, in Files.
name string
size integer
created integer

Errors

Status Means
400 The request cannot succeed as sent โ€” an unusable name, or a server with no DATA_DIR to keep files in. Do not retry it unchanged.
401 Missing or wrong bearer token.
404 No such browser session, or no such file in it. It ended, the Grid reaped it, or the id was never real.
413 The body is over its cap: 1 MiB of JSON, 64 MiB of upload, 1 MiB of flow YAML. Send less; retrying it unchanged will fail again.
500 Something failed that this server did not expect.
503 The Grid could not serve this โ€” unreachable, or failing. Worth retrying after a wait.

Over MCP the same failures arrive as a tool error.

Example

MCP

keep_file(folder="screenshots", name="โ€ฆ")

HTTP

curl -X PUT $SELENIUM_FLOW/files/screenshots/my-flow/kept \
  -H "Authorization: Bearer $TOKEN" \
  -H "X-Workspace: $WORKSPACE"

Over MCP it is one argument, uri

The example above is generated from the HTTP path, which needs the folder and the name apart to route the request โ€” that is what the two path segments are for. The tool itself takes the composed address instead:

keep_file(uri="workspace://files/screenshots/hangar-check.png")

Every listing already hands you this uri on each entry, so there is nothing to build by hand. A URI that already names a file in Files is accepted too โ€” keep_file then answers with that file, unchanged.


โ† All actions ยท Installing ยท Deployment

โš ๏ธ **GitHub.com Fallback** โš ๏ธ