Skip to main content
Glama

auto_generate_tests

Analyze a URL to detect modules and automatically generate pytest test skeletons for each module. Returns generated file paths and test counts, with optional plan verification integration.

Instructions

一鍵交付:在內部依序做 analyze_url → 為每個偵測到的 module 用 candidate_tcs 內容各跑一次 generate_test,把整套 pytest 測試骨架寫進 PROJECT_ROOT/tests/。等同於『analyze_url 後對每個 module 手動跑 N 次 generate_test』的自動化版本,適合「給我一個 URL、其他你看著辦」這種快速覆蓋場景。每條 candidate_tc 變成對應 test 函式的 docstring,run_tests 跑完 HTML 報告會用 docstring 當 case 名稱顯示。回傳產生的檔案路徑列表 + 每個 module 對應幾個 test。預設每個 module 1 條,想要更密的覆蓋拉 tests_per_module。

Plan bookend (v0.10.0): pass plan_id from a prior qa_plan call and the response auto-attaches plan_verification. Each generated test record (or generation failure) becomes an evidence row with kind=generated_test, path, covers_module (form/cta/nav/etc.), module_name, error (None on success), and source url. CPs can assert coverage ("form module produced ≥1 test") or failure-mode invariants ("no module had generation errors").

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes要分析並批次產測的 URL,需含 protocol(http:// 或 https://)。
timeout_msNo選填,analyze_url 內部 page.goto 等 DOMContentLoaded 的逾時毫秒。預設 15000,慢站可拉到 30000+。
auth_cookieNo選填,登入後分析所需 cookie,格式:`name1=value1; name2=value2`。從 DevTools / Application / Cookies 抓現成值貼進來。
tests_per_moduleNo選填,每個 module 從 candidate_tcs 取前 N 條各產一條 test。1-10,預設 1(最少噪音)。想要更密的覆蓋拉 3-5;拉到 10 通常會產 garbage tests,因為 candidate_tcs 後段是泛例。
plan_idNo選填,v0.10.0+. Plan id returned by qa_plan. When supplied, the response gains a `plan_verification` envelope. Each generated test record (success or failure) becomes one evidence row with kind=generated_test, path, covers_module, module_name, error (None on success), and source url.
Behavior4/5

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

With no annotations provided, the description carries full burden. It details the internal sequence (analyze_url, then generate_test per module), side effects (writing files to PROJECT_ROOT/tests/), behavior of tests_per_module (up to 10 may produce garbage), and the plan_id feature attaching evidence rows. It does not cover error handling for analyze_url failures, but the plan bookend section acknowledges generation failures.

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

Conciseness3/5

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

The description is lengthy and contains non-English text (Chinese), which may reduce clarity. However, it is front-loaded with the core action and each subsequent sentence adds useful detail. It could be more concise by separating the plan bookend section more elegantly.

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?

Given no output schema, the description explains the return value (list of file paths and test counts), and the enhanced response with plan_id. It covers the workflow, parameters, and limitations. It is largely complete for a composite tool with 5 parameters, though the exact return structure without plan_id could be more explicit.

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 description coverage is 100%, baseline 3. The description adds value beyond schema for multiple parameters: tests_per_module warns about garbage at high values, auth_cookie provides practical source instructions, and plan_id explains the plan_verification envelope and evidence row structure.

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 clearly states the tool automates the process of analyzing a URL and generating tests for each detected module, writing pytest skeletons to a directory. It differentiates itself from siblings by being a one-click automation of manual sequential steps, as explicitly noted.

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 description specifies the tool is suitable for rapid coverage scenarios where the user provides a URL and expects automated test generation. It contrasts with manual execution of analyze_url and generate_test, and mentions the optional plan_id integration for QA plan workflows. However, it does not explicitly state when not to use it or provide alternatives for fine-grained control.

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