Skip to main content
Glama

Save a login session

save-login
Idempotent

Log in once and save the session as a storageState file for tests and page tools; valid sessions are reused, expired ones trigger a fresh login with secrets kept out of chat.

Instructions

Log in once and save the session as a storageState file (default playwright/.auth/.json) for tests and the page tools. If a saved session still passes verify it is reused; expired ones log in again. Secrets stay out of chat: fill values use {{env:E2E_PASSWORD}} and {{totp}} (authenticator code from totpSecretEnv).

Input Schema

NameRequiredDescriptionDefault
urlYesLogin page URL (http/https)
nameNoSession name, e.g. 'admin' (default 'user'); saved to playwright/.auth/<name>.json
pathNoWhere to save the storageState JSON inside the project (overrides name)
reuseNoKeep a saved session that still passes verify instead of logging in again (default true)
verifyNoHow to tell the session works; also used to decide whether a saved session is still valid
actionsNoLogin steps. In fill values write {{env:E2E_PASSWORD}} for a secret from the environment and {{totp}} for an authenticator code, never the secret itself. End with a 'wait' on something only signed-in users see
headersNoExtra HTTP headers
viewportNo
timeoutMsNoOverall limit in ms (default 60000)
projectRootNoProject directory (default: server root)
totpSecretEnvNoEnvironment variable holding the authenticator secret (base32 or otpauth:// URI), for {{totp}}
actionTimeoutMsNoHow long each step waits for its element (default 10000)

Output Schema

NameRequiredDescriptionDefault
okYesfalse when the call failed (see error) or the tests it ran failed
urlNo
pathNosave-login: the storageState file, relative to the project
errorNo
validNovalidate-selector: the selector parsed and ran
statusNo
expiresAtNosave-login: when the first session cookie expires (ISO)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.7.0

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the annotations (idempotent, non-destructive, open-world) it discloses the file write and its default location, the conditional re-login behavior driven by verify, and how secrets are kept out of chat via {{env:...}} and {{totp}}. What is missing is failure/error behavior (e.g., what happens when verify never passes).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three dense sentences, front-loaded with the core action and destination path before the reuse and secret-handling details. Nothing is filler, though the second and third sentences pack several distinct ideas that could be split for scanability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 12-parameter tool with nested action/verify objects the description covers the concepts an agent most needs: what is produced, where, reuse semantics, and secret templating; an output schema exists so return values need no explanation. Edge cases such as timeout expiry or directory creation are left implicit.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is already 92%, so the baseline is a 3; the description still adds real meaning by explaining the fill-value templating, tying {{totp}} to totpSecretEnv, and prescribing that actions should end with a 'wait' on a signed-in-only element. That is guidance the schema does not encode.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb+resource (log in once and save the session as a storageState file) and states the default destination path, so an agent knows exactly what artifact the tool produces. It also contrasts with the rest of the suite ('for tests and the page tools'), making the tool's role distinct from siblings like inspect-page or run-test.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It states the reuse policy ('if a saved session still passes verify it is reused; expired ones log in again') and its consumer contexts (tests, page tools), which tells an agent when to reach for it. It stops short of explicit exclusions or naming an alternative tool for one-off interactive browsing, so it isn't a full when/when-not map.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.