Skip to main content
Glama
Unified MCP Server

Unified MCP Server

by qingyunyupan

code_test_generate

Generate unit tests for supplied Python or JavaScript code, with support for pytest, unittest, Jest, and Mocha. Use it to turn existing functions into runnable test cases.

Instructions

为给定代码自动生成单元测试。支持pytest、unittest(Python)和Jest、Mocha(JavaScript)等测试框架。

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": {
      "code": "<code>",
      "language": "<language>"
    },
    "name": "code_test_generate"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYes要生成测试的代码
languageYes代码语言
frameworkNo测试框架(可选)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.1/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full behavioral burden and does not discharge it. It never says whether generated tests are returned as text or written to files, whether existing test files are overwritten, or whether tests are executed. The framework list it names duplicates the enum values already present in the schema.

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?

Two short sentences, with the core action front-loaded and the framework support listed second. The framework enumeration is partly redundant with the schema enums, but the language pairing gives it some justification.

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

Completeness2/5

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

For a code-generation tool with no annotations and no output schema, an agent still lacks essential information: the output form, whether files are written or overwritten, and expected input size limits. The description is too thin relative to the complexity of the operation.

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 description adds a small amount of meaning by pairing frameworks with languages (pytest/unittest for Python, Jest/Mocha for JavaScript), which is not explicit in the schema enums, but it gives no other parameter guidance.

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 states a specific verb and resource: automatically generating unit tests for supplied code. It adds the supported frameworks, which further narrows the scope. It does not distinguish itself from neighbors like code_tdd or code_generate, so it stops short of a 5.

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

Usage Guidelines3/5

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

Usage is only implied: the phrase 'for given code' signals that code and a language are required inputs. There is no explicit statement of when to choose this tool over code_tdd or code_generate, and no exclusions or prerequisites.

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