Skip to main content
Glama

generate_mocha_test

Generate a Mocha + Chai test suite: real assertions from {input, expected|throws} cases, pending tests for described cases

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": {
      "functionName": "<functionName>",
      "modulePath": "<modulePath>"
    },
    "name": "generate_mocha_test"
  }
}

Input Schema

NameRequiredDescriptionDefault
asyncNo
testCasesNoTest cases. Either a description string (generated as a pending test) or {name, input: [args...], expected} / {name, input, throws: true | "message"} for a real assertion.
modulePathYes
functionNameYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / properties / testCases / description
      Added value: +"Test cases. Either a description string (generated as a pending test) or {name, input: [args...], expected} / {name, input, throws: true | \"message\"} for a real assertion."
    • addedInput schema / properties / testCases / items / anyOf
      Added value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "properties": {
      +      "expected": {
      +        "description": "Expected return value (deep equality)"
      +      },
      +      "input": {
      +        "description": "Arguments (array) or a single argument"
      +      },
      +      "name": {
      +        "type": "string"
      +      },
      +      "throws": {
      +        "description": "true, or a substring of the expected error message"
      +      }
      +    },
      +    "required": [
      +      "name"
      +    ],
      +    "type": "object"
      +  }
      +]
    • removedInput schema / properties / testCases / items / type
      Removed value: -"string"
  2. First observed

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations, the description carries the full burden, but it discloses very little beyond mechanics already present in the testCases schema entry. It never says where the file is written, whether existing files are overwritten, what the tool returns (path? code? nothing), or how async/hook setup is handled. The pending-vs-real-assertion behavior is the only disclosed trait and it duplicates 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?

A single front-loaded sentence with a colon and a compact enumeration; nothing is wasted and the purpose leads. The brace notation ('{input, expected|throws} cases') is dense to the point of being cryptic on first read, which keeps it from a 5.

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 4-parameter code-generation tool with zero annotations and no output schema, the description is missing the information an agent most needs to call it correctly: how modulePath/functionName are interpreted and what the call produces. The return value is not covered elsewhere, so the description should say what comes back.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is only 25%: testCases is documented, but modulePath, functionName, and async have no descriptions at all. The description restates the {input, expected|throws} shape without clarifying the critical unresolved points — is modulePath a require path, relative file path, or package name; is functionName the exported symbol to import; what does async change in the generated code.

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?

States a specific verb and resource ('Generate a Mocha + Chai test suite') and the framework name does implicitly separate it from the Jest/Vitest/Pytest siblings. The second clause adds real scope detail: cases with input/expected/throws become real assertions while bare description strings become pending tests. It never names a sibling or routing condition, 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 agent can infer that a case must supply expected or throws to get a real assertion, and that a plain string yields a skipped test. There is no explicit statement of when to choose this tool over generate_jest_test or generate_vitest_test, and no prerequisites (mocha/chai installed, how modulePath resolves relative to the project).

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.