Skip to main content
Glama

codegen

Record browser interactions in a live Chromium window to generate pytest test code. Build baseline tests interactively before refining with automated tools.

Instructions

Launch interactive test recording for the active runner. Useful as a baseline-builder before refining with generate_test.

Behavior:

  • pytest-playwright: spawns playwright codegen -o <output> <url> — a real Chromium window opens, you click / type / navigate, Playwright transcribes every action into runnable pytest code, output is saved to PROJECT_ROOT/ on browser close

  • Maestro: returns a human-readable hint string pointing at maestro studio (no shell-able codegen exists for it)

  • jest / cypress / go runners: same Maestro-style fallback hint Returns: a string with the saved path or the manual-record hint.

When to use:

  • Building a baseline happy-path test interactively (you click, it transcribes)

  • Site has complex auth / JS state you'd rather not script by hand

  • Quick prototype before refining with generate_test

  • User says 「record / 錄製 / use codegen / 紀錄操作」

When NOT to use:

  • Headless CI / container environments → can't open Chromium

  • Need structured, AI-driven test generation from analysis → use generate_test or auto_generate_tests instead

  • One-shot per-module test coverage → use auto_generate_tests

  • Mobile UI flows → returns a hint anyway, consider analyze_screen + generate_test instead

Edge cases:

  • output contains .. or is absolute → blocked by security guardrail

  • Chromium not installed → playwright codegen fails; user sees the playwright install hint in stderr

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes受測 URL。Playwright codegen 會開瀏覽器 navigate 到此網址、從這頁開始錄製你的互動。
outputNo選填,輸出檔名(相對於 PROJECT_ROOT,不可絕對路徑、不可含 `..`)。預設 `recorded_test.py`。recorded_test.py
Behavior5/5

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

No annotations provided, so description carries full burden. It details the behavior for each runner (e.g., spawning real Chromium for pytest-playwright, returning hint for others), explains edge cases like security guardrails and Chromium installation issues, and states return value type.

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?

Description is fairly long but well-structured with clear sections (Behavior, When to use, When NOT to use, Edge cases). Each sentence adds value; minimal redundancy. Slightly verbose in parts but justified by complexity.

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?

Description covers all necessary aspects: purpose, usage guidelines, behavioral details, parameter semantics, edge cases, and return value. Given no output schema, it adequately describes the return string. Comprehensive for agent invocation.

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 100% (both parameters described in schema), but description adds value by explaining the security constraint on 'output' (no absolute path, no '..') and clarifying that 'url' is navigated to in a browser. This goes beyond the schema descriptions.

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?

Description clearly states it launches interactive test recording for the active runner, positioning it as a baseline-builder before generate_test. It distinguishes from siblings by explicitly mentioning when to use vs. alternatives like generate_test and auto_generate_tests.

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

Usage Guidelines5/5

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

Provides explicit 'When to use' and 'When NOT to use' sections with concrete scenarios and alternative tool names, offering strong guidance for agent decision-making.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kao273183/mk-qa-master'

If you have feedback or need assistance with the MCP directory API, please join our Discord server