Skip to main content
Glama

WatchFor

Test a Playwright script

test_playwright_script

Browser checks: runs a Playwright Test script once in a sandboxed browser without saving it (write scope; counts against the plan's test runs per hour). The script is a normal @playwright/test file: import { test, expect } from '@playwright/test', test.step(...) for readable steps, process.env.TARGET_URL for the site and process.env.NAME for organization variables and secrets. It runs with those secrets in its environment and can reach any public host. A script error returns 400 naming the line. Waits up to ~60 s and returns the run (status passed/flaky/failed/timed_out/script_error/infra_error, failed step with its error and code frame, console errors, failed requests, Web Vitals) plus missing_variables: the process.env names the organization hasn't set, which are unset when the script runs. A run still going after that returns its test_run_id instead.

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": {
      "script": "<script>",
      "target": "<target>"
    },
    "name": "test_playwright_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
scriptYesThe Playwright Test file
targetYesThe site under test (TARGET_URL)
location_idNoA probe location id with browser support; omitted = the nearest
timeout_secondsNoRun timeout in seconds, 10-180

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior5/5

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

Beyond the annotations, it discloses quota consumption ('counts against the plan's test runs per hour'), that secrets live in the script's environment, that any public host is reachable, the ~60 s wait ceiling, the 400 response naming the failing line, and the full status vocabulary. That is exactly the behavioral context annotations cannot convey and goes well past readOnlyHint/openWorldHint.

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?

The critical scoping facts (sandboxed, not saved, quota, secrets) are front-loaded and the run/return details follow. It is dense but dense with substance; a couple of the long multi-clause sentences could be split for scannability.

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

Completeness5/5

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

With no output schema, the description carries the return-value burden and does so fully: status enum, failed step with code frame, console errors, failed requests, Web Vitals, and missing_variables, plus the fallback test_run_id for runs exceeding the wait. Nothing an agent needs to invoke and interpret a call is missing.

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 100%, so the baseline is 3; the description adds real meaning by tying 'target' to process.env.TARGET_URL and explaining that process.env names resolve to the organization's variables and secrets. Only location_id is left purely to the schema, keeping this below a 5.

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

Purpose4/5

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

The description opens with a specific verb and resource: 'runs a Playwright Test script once in a sandboxed browser without saving it.' The 'without saving it' scope and the note that long runs return a test_run_id implicitly distinguish this one-shot execution from the sibling retrieval tools (get_playwright_run, list_playwright_runs), though neither sibling is named directly.

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 gives clear context for when this tool applies: browser checks against a scripted Playwright Test file, with TARGET_URL and organization variables/secrets injected. There is no explicit when-not guidance or routing to an alternative, but the constraints (write scope, hourly plan quota, public hosts only) effectively delimit the use case.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.