Skip to main content
Glama

Save a login session

save-login
Idempotent

Log in once and save the authenticated session as a storageState file for Playwright tests and page tools; reuse it while valid and sign in again when it expires.

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).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "url": "<url>"
    },
    "name": "save-login"
  }
}

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. Changed6 schema fields changedv0.13.0
    • removedInput schema / $schema
      Removed value: -"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / additionalProperties
      Removed value: -{}
    • changedInput schema / properties / actions / items / properties / type / enum
      Previous value: -[
      -  "goto",
      -  "click",
      -  "dblclick",
      -  "hover",
      -  "fill",
      -  "press",
      -  "check",
      -  "uncheck",
      -  "select",
      -  "wait"
      -]New value: +[
      +  "goto",
      +  "click",
      +  "dblclick",
      +  "hover",
      +  "fill",
      +  "press",
      +  "check",
      +  "uncheck",
      +  "select",
      +  "wait",
      +  "switchTab"
      +]
    • changedInput schema / properties / actions / items / properties / value / description
      Previous value: -"fill text, press key, select option"New value: +"fill text, press key, select option; switchTab: 'last' (default), 'first', a 1-based number, or text in the tab's URL or title"
    • removedInput schema / properties / actions / maxItems
      Removed value: -20
    • removedInput schema / properties / headers / propertyNames
      Removed value: -{
      -  "type": "string"
      -}
  2. Addedv0.7.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare non-read-only, idempotent, open-world; the description goes beyond them by disclosing the on-disk artifact, the reuse-if-still-valid semantics that justify idempotency, and the expiry re-login path. It does not say what happens when login fails or what the file contains, so it's strong but not exhaustive.

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

Conciseness5/5

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

Three sentences, zero filler, front-loaded with what the tool produces and the default path. The security constraint is stated compactly rather than as a lecture.

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 objects, the description covers the non-obvious parts (secret placeholders, TOTP source, verify-based reuse) while the schema and output schema handle the rest. Failure behavior and the file's contents are the only meaningful gaps.

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 92%, so the baseline is 3, and the description still adds real value beyond it: the {{env:E2E_PASSWORD}} and {{totp}} placeholder contract for fill values, the link to totpSecretEnv, and the rule to end actions with a 'wait' on a signed-in-only element.

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?

States a specific verb and resource ('Log in once and save the session as a storageState file'), including the default artifact path and the two consumers (tests and page tools). It is immediately distinguishable from the sibling tools, none of which create session state.

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?

The opening clause 'for tests and the page tools' tells the agent when this tool is relevant, and the reuse/verify sentence explains the re-run condition. It stops short of explicitly naming alternatives (e.g. inspect-page for ad-hoc browsing), so it's clear context without exclusions.

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