Skip to main content
Glama

Save login state

save_login_state

Log in once by executing login-page steps, then save browser cookies and storage to a JSON file for reuse as storage state in other tools and Playwright tests.

Instructions

Log in once by running steps on a login page, then save the browser's cookies and storage to .qa-mcp/auth/.json. Pass that file as session.storage_state to other tools, or to Playwright's storageState in tests. Put passwords in environment variables and reference them as ${ENV:NAME}; never pass them literally. The saved file contains session tokens: keep .qa-mcp/auth out of version control.

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>",
      "steps": "<steps>"
    },
    "name": "save_login_state"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlYesLogin page URL
nameNodefault
stepsYes
deviceNoEmulate a device for mobile web: a Playwright device name such as "iPhone 15" or "Pixel 7" (list_devices), or "desktop" (default)
success_locatorNoLocator that must be visible after login, e.g. page.getByRole('heading', { name: 'My account' })

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.3.0
    • addedInput schema / properties / device
      Added value: +{
      +  "description": "Emulate a device for mobile web: a Playwright device name such as \"iPhone 15\" or \"Pixel 7\" (list_devices), or \"desktop\" (default)",
      +  "type": "string"
      +}
  2. First observedv0.2.1

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does it well: it discloses that a file is written, that it holds session tokens, that secrets must come from ${ENV:NAME}, and that .qa-mcp/auth should stay out of version control. It omits overwrite behavior for an existing name and what happens if the login never succeeds.

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?

Four tight sentences: what it does, where the output goes, how to reuse it, and the security constraint. Nothing is redundant and the primary purpose is front-loaded.

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 five-parameter tool with a nested steps array, no annotations, and no output schema, the description covers the important unknowns: the return artifact, its security profile, and downstream usage. Failure handling and overwrite semantics are the remaining gaps.

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

Parameters3/5

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

Schema coverage is 60% and the description clarifies that `name` maps into the saved file path and that secret values go through ${ENV:NAME}. It adds nothing about success_locator, device, or the step action semantics, leaving those to the schema.

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 concrete verb chain (run login steps, then save cookies and storage) and names the exact artifact produced, .qa-mcp/auth/<name>.json. The resource and its downstream role are unambiguous without opening the schema.

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?

Explicitly tells the agent how to consume the result (pass as session.storage_state to other tools, or Playwright storageState in tests), which is real routing guidance. It does not address when not to use it, e.g. reusing an already-saved state instead of re-logging in.

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