Skip to main content
Glama

run_mutmut

Execute mutation testing on Python code to identify untested sections by running mutmut on specified modules or packages with optional virtual environment support.

Instructions

Run a full mutation testing session with mutmut on the specified target.

This tool initiates mutation testing on the given module or package. You can provide additional mutmut options as needed. The output includes a summary of mutations tested, including counts of killed, survived, and timed-out mutations. If a virtual environment path is provided, mutmut will be run using the binaries from that environment to ensure compatibility with project-specific dependencies.

Args: target (str): The module or package to run mutation testing on. options (str): Additional command-line options for mutmut (e.g., '--use-coverage'). Defaults to empty. venv_path (Optional[str]): Path to the project's virtual environment to use for running mutmut. Defaults to None.

Returns: str: Summary of the mutation testing run, or error message if the run fails.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetYes
optionsNo
venv_pathNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function 'run_mutmut' which executes the mutation testing command.
    def run_mutmut(target: str, options: str = "", venv_path: Optional[str] = None) -> str:
        """
        Run a full mutation testing session with mutmut on the specified target.
    
        This tool initiates mutation testing on the given module or package. You can provide
        additional mutmut options as needed. The output includes a summary of mutations tested,
        including counts of killed, survived, and timed-out mutations. If a virtual environment
        path is provided, mutmut will be run using the binaries from that environment to ensure
        compatibility with project-specific dependencies.
    
        Args:
            target (str): The module or package to run mutation testing on.
            options (str): Additional command-line options for mutmut (e.g., '--use-coverage'). Defaults to empty.
            venv_path (Optional[str]): Path to the project's virtual environment to use for running mutmut. Defaults to None.
    
        Returns:
            str: Summary of the mutation testing run, or error message if the run fails.
        """
        if venv_path:
            mutmut_path = _get_mutmut_path(venv_path)
            if not os.path.exists(mutmut_path):
                return f"Error: mutmut not found in the specified venv at {mutmut_path}. Please ensure mutmut is installed in the venv."
            command = [mutmut_path, "run", target] + options.split()
        else:
            command = ["mutmut", "run", target] + options.split()
        return _run_command(command)
  • mutmut_mcp.py:182-182 (registration)
    Registration of the 'run_mutmut' tool with the MCP server.
    mcp.tool()(run_mutmut)
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes what the tool does (runs mutation testing, outputs a summary or error), and adds useful context about virtual environment usage. However, it lacks details on potential side effects (e.g., file system changes), performance characteristics (e.g., runtime, resource usage), or error handling beyond a generic mention of failure.

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?

The description is well-structured with a clear opening sentence, followed by details on parameters and returns. It avoids redundancy and stays focused, though the parameter explanations could be slightly more concise (e.g., merging some details). Every sentence adds value, and it's appropriately sized for a tool with three parameters.

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 complexity of a mutation testing tool with no annotations, 0% schema coverage, but an output schema (implied by 'Returns'), the description is fairly complete. It covers purpose, parameters, and output behavior. However, it could better address error scenarios, prerequisites (e.g., mutmut installation), or integration with sibling tools to enhance contextual understanding.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate. It effectively explains all three parameters: 'target' as the module/package to test, 'options' as additional command-line arguments with an example, and 'venv_path' as an optional path for environment compatibility. This adds significant meaning beyond the bare schema, though it could provide more examples or constraints for 'options'.

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 specific action ('run a full mutation testing session') on a specific resource ('the specified target') using a specific tool ('mutmut'). It distinguishes itself from siblings like 'clean_mutmut_cache' or 'show_results' by focusing on execution rather than cleanup or display.

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 provides clear context for when to use this tool ('initiates mutation testing on the given module or package') and mentions the optional virtual environment path for compatibility. However, it doesn't explicitly state when NOT to use it or name specific alternatives among the sibling tools, such as when to use 'rerun_mutmut_on_survivor' instead.

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

Install Server

Other Tools

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/wdm0006/mutmut-mcp'

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