Skip to main content
Glama

gentest

Read-onlyIdempotent

Generate unit test code by providing a source file or code snippet. Specify the testing framework and project root to produce complete, runnable tests without executing them.

Instructions

当用户需要为代码生成单元测试时使用。指南型工具:注入 code/file_path 与测试清单,由 Agent 生成完整测试代码;MCP 不自动生成或运行测试

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNo要生成测试的代码。可以是函数、类或模块
file_pathNo要生成测试的源文件路径(相对 project_root 或绝对路径)。未传 code 时从磁盘读取
frameworkNo测试框架:jest、vitest、mocha。可选,会自动识别项目使用的框架
project_rootNo项目根目录绝对路径。配合 file_path 解析相对路径

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed2 schema fields changedv3.6.11
    • addedInput schema / properties / file_path
      Added value: +{
      +  "description": "要生成测试的源文件路径(相对 project_root 或绝对路径)。未传 code 时从磁盘读取",
      +  "type": "string"
      +}
    • addedInput schema / properties / project_root
      Added value: +{
      +  "description": "项目根目录绝对路径。配合 file_path 解析相对路径",
      +  "type": "string"
      +}
  2. Changed3 schema fields changedv3.0.16
    • addedInput schema / additionalProperties
      Added value: +true
    • changedInput schema / properties / code / description
      Previous value: -"需要测试的代码"New value: +"要生成测试的代码。可以是函数、类或模块"
    • changedInput schema / properties / framework / description
      Previous value: -"测试框架:jest, vitest, mocha(默认 jest)"New value: +"测试框架:jest、vitest、mocha。可选,会自动识别项目使用的框架"
  3. First observed

TDQS

A4.2/5.0
Behavior4/5

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

The description adds behavioral context beyond the annotations (readOnlyHint, idempotentHint) by clarifying that it is a '指南型工具' (guide-type tool) where 'MCP 不自动生成或运行测试' (MCP does not automatically generate or run tests) and '由 Agent 生成完整测试代码' (the agent generates complete test code). This explains the tool's role as a guide, not a direct executor. No contradiction with annotations.

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?

The description is exceptionally concise: two sentences, front-loaded with the purpose, and every sentence provides essential information. No unnecessary words or repetition.

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 the 100% schema coverage, no output schema, and no nested objects, the description adequately covers the tool's purpose and behavior. It explains the guide nature and the agent's role. A minor gap is the lack of information about the return value or output, but this is mitigated by the readOnlyHint and the description's clarity.

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 description coverage is 100%, so the baseline is 3. The tool description does not add any parameter-specific information beyond what the schema already provides. The mention of '注入 code/file_path 与测试清单' is too vague to add meaningful semantics.

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's purpose: '当用户需要为代码生成单元测试时使用' (use when user needs to generate unit tests for code). It specifies the verb (generate), resource (unit tests), and distinguishes from sibling tools like code_review or refactor by being exclusively for test generation.

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 explicitly states the usage condition: '当用户需要为代码生成单元测试时使用' (use when user needs to generate unit tests). It provides clear context but does not list when not to use or mention alternatives, which would be beneficial given the large sibling set.

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

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/mybolide/mcp-probe-kit'

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