Skip to main content
Glama

generate_pytest_test

Generate a pytest module: parametrized real assertions from {input, expected|throws} cases, skipped tests for described cases, fixtures

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

Input Schema

NameRequiredDescriptionDefault
fixturesNo
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.
modulePathYesPython module path, e.g. app.orders or app/orders.py
parametrizeNo
functionNameYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedInput schema / properties / modulePath / description
      Added value: +"Python module path, e.g. app.orders or app/orders.py"
    • 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

B3.4/5.0
Behavior4/5

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

With zero annotations the description carries the full burden, and it does disclose non-obvious behavior: object cases with expected/throws become real parametrized assertions while bare-string cases become skipped/pending tests. It omits side-effect semantics, however – whether a file is written at modulePath, whether an existing file is overwritten, and what is returned – which matters for a code generator.

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 packs the generation rules into few words with no filler. It is slightly telegraphic – 'fixtures' dangles as a noun fragment – but nothing is wasted.

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

Completeness3/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 annotations, no output schema, and partial schema descriptions, the definition covers the main case-handling logic but leaves functionName, the boolean parametrize flag, and file-write/overwrite behavior unexplained. An agent could call it, but would be guessing on some parameters.

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 coverage is only 40%, and the description partially compensates by explaining how testCases entries map to assertions vs. skipped tests and by mentioning parametrization and fixtures. It adds nothing for functionName (undocumented in both places) and leaves fixtures/parametrize as bare keywords, so compensation is incomplete.

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 concrete verb+resource ('Generate a pytest module') and enumerates what the generated module contains: parametrized real assertions, skipped tests, fixtures. That is enough to distinguish it from the other framework-specific generate_*_test siblings without opening the schema, though it never explicitly says 'this is the Python/pytest one'.

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

Usage Guidelines2/5

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

There is no when-to-use/when-not guidance, no mention of prerequisites (e.g. that modulePath must be an existing module), and no routing to alternatives such as generate_test_fixtures for fixture-only work. Usage can only be inferred from the enumeration of supported case shapes.

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.