Skip to main content
Glama

run_locust

Execute load tests on web applications by configuring virtual users, spawn rates, and test duration to measure performance under simulated traffic.

Instructions

Run Locust with the given configuration.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
test_fileYes
hostNohttp://localhost:8089
usersNo
spawn_rateNo
runtimeNo30s
headlessNo

Implementation Reference

  • The run_locust tool handler: an async function decorated with @mcp.tool that runs the Locust load testing tool via subprocess.run, constructing the command based on parameters and returning success/error status with output.
    @mcp.tool(name="run_locust", description="Run Locust with the given configuration.")
    async def run_locust(test_file: str, host: str = os.getenv("LOCUST_HOST", "http://localhost:8089"), 
                        users: int = int(os.getenv("LOCUST_USERS", "100")), 
                        spawn_rate: int = int(os.getenv("LOCUST_SPAWN_RATE", "10")), 
                        runtime: str = os.getenv("LOCUST_RUNTIME", "30s"), 
                        headless: bool = os.getenv("LOCUST_HEADLESS", "true").lower() == "true") -> Any:
        """
        Run Locust with the given configuration.
        
        Args:
            test_file: Path to the Locust test file
            host: Target host URL to load test
            users: Number of concurrent users to simulate
            spawn_rate: Rate at which users are spawned per second
            runtime: Duration of the test (e.g., "30s", "1m", "5m")
            headless: Whether to run in headless mode (no web UI)
        """
        locust_bin = os.getenv("LOCUST_BIN", "locust")
        cmd = [locust_bin, "-f", test_file, "--host", host]
        
        if headless:
            cmd.extend(["--headless"])
            cmd.extend(["-u", str(users)])
            cmd.extend(["-r", str(spawn_rate)])
            cmd.extend(["-t", runtime])
        
        try:
            result = subprocess.run(cmd, capture_output=True, text=True, check=True)
            return {
                "status": "success",
                "output": result.stdout,
                "error": result.stderr
            }
        except subprocess.CalledProcessError as e:
            return {
                "status": "error",
                "output": e.stdout,
                "error": e.stderr
            }
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 burden of behavioral disclosure. It mentions 'run' but doesn't clarify if this is a read-only operation, if it modifies state (e.g., starts a process), potential side effects (e.g., consuming resources), or expected outputs (e.g., test results). This leaves significant gaps in understanding the tool's behavior.

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 a single, straightforward sentence that is front-loaded and wastes no words. However, it's overly concise to the point of under-specification, which slightly reduces its effectiveness. Still, it's structurally sound with no redundant information.

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?

Given the complexity (6 parameters, no annotations, no output schema), the description is incomplete. It doesn't cover what the tool does beyond a high-level action, leaving the agent unsure about execution details, results, or error handling. This inadequacy is notable for a tool with multiple configuration options.

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 0%, so the description must compensate but fails to do so. It doesn't explain any parameters beyond implying a 'configuration' exists. For example, it doesn't clarify what 'test_file' should contain, the meaning of 'users' or 'spawn_rate', or how 'runtime' is formatted. This leaves all 6 parameters poorly understood.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Run Locust with the given configuration' states the action ('Run') and target ('Locust'), but it's vague about what Locust is (a load testing tool) and what 'run' entails (e.g., executing tests). It doesn't distinguish from siblings, but since there are none, this is less critical. However, the purpose remains somewhat ambiguous without context.

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?

The description provides no guidance on when to use this tool, such as for performance testing scenarios, prerequisites (e.g., having Locust installed), or alternatives. With no sibling tools, differentiation isn't needed, but it still lacks any usage context, leaving the agent to infer from the tool name and parameters alone.

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/QAInsights/locust-mcp-server'

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