Skip to main content
Glama

generate_jest_test

Generate a Jest test suite: real assertions from {input, expected|throws} cases, pending it.todo for described cases, async support, module mocks

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_jest_test"
  }
}

Input Schema

NameRequiredDescriptionDefault
asyncNo
mockDepsNoModule paths to replace with automatic mocks
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.
modulePathYesImport path of the module under test, e.g. ./src/orders/createOrder
functionNameYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • addedInput schema / properties / mockDeps / description
      Added value: +"Module paths to replace with automatic mocks"
    • addedInput schema / properties / modulePath / description
      Added value: +"Import path of the module under test, e.g. ./src/orders/createOrder"
    • 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

A3.5/5.0
Behavior3/5

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

With no annotations at all, the description carries the full behavioral burden. It does usefully disclose that string-only cases become pending `it.todo` entries rather than failing assertions, and that mocks replace modules — non-obvious output behavior. However, it says nothing about whether files are written to disk, where they land, whether existing files are overwritten, or what the tool returns, all material for a code-generation mutation.

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 that leads with the framework and then the capabilities, with no filler. The colon-and-list construction is dense but readable and every clause carries information. Minor cost: the terse phrasing of '{input, expected|throws}' assumes the reader cross-references the schema.

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?

For a 5-parameter generator with no output schema and no annotations, the description covers what the generated artifact looks like well enough to invoke the tool correctly. The main gap is operational: where output goes and what is returned. That is notable for a file-generating tool but does not block correct parameter selection.

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 60%, and the schema already explains modulePath, mockDeps, and the testCases discriminated union in detail. The description adds meaning by tying the {input, expected|throws} shape to real assertions versus todo stubs, but leaves functionName and async essentially unexplained beyond the word 'async support'. It partially compensates for the coverage gap without closing it.

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 opens with a specific verb and resource ('Generate a Jest test suite') and names the exact framework, which is what separates it from siblings like generate_mocha_test or generate_vitest_test. It then enumerates the concrete outputs (assertions, it.todo stubs, async, mocks), so an agent knows precisely what it gets. No sibling is named explicitly for routing, which keeps it from 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: an agent infers it should call this when the target project uses Jest. There is no statement of when to prefer it over the other framework generators, no prerequisites (e.g., does the project already have Jest configured?), and no exclusions such as component rendering tests belonging to RTL/vitest component tools.

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.