Skip to main content
Glama

Write test file

write_test

Writes a Playwright spec into the project's tests/ folder, blocks paths outside tests/, and prevents overwrites unless overwrite is enabled.

Instructions

Write a Playwright spec into the project's tests/ folder. Refuses paths outside tests/ and will not overwrite unless overwrite=true.

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": {
      "path": "<path>",
      "code": "<code>"
    },
    "name": "write_test"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYes
pathYesRelative to tests/, e.g. login.spec.ts
overwriteNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.1

TDQS

A4/5.0
Behavior3/5

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

With no annotations, the description carries the full disclosure burden, and it does surface two real behavioral traits: path scoping rejection and non-destructive default overwrite. It omits other meaningful behavior for a filesystem mutation, such as whether missing directories are created, what happens to an existing file on overwrite, and what the tool returns.

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?

Two sentences, no filler, and the core action and target location come first with the safety constraints immediately after. Every clause earns its place.

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 three-parameter file-write tool with no annotations or output schema, the description covers the essential guardrails an agent needs to avoid a failed or destructive call. Only the return value and code-content expectations are left implicit.

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 only 33%, with just `path` documented (relative to tests/). The description compensates partly by scoping paths to tests/ and explaining overwrite's default false semantics, and 'Playwright spec' hints at the `code` parameter's content, but the format and expectations for `code` remain unstated.

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 states a specific verb ('Write') and resource ('a Playwright spec') plus the exact destination ('the project's tests/ folder'). That distinguishes it from siblings like run_tests or check_locator, which operate on specs rather than authoring them.

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?

Use context is clear: authoring a Playwright spec into tests/. Two hard constraints (no paths outside tests/, no overwrite without overwrite=true) tell the agent when the call will be rejected, but there is no explicit routing advice versus siblings such as run_tests or capture_baseline.

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