Skip to main content
Glama

execute_jmeter_test_non_gui

Run JMeter performance tests in non-GUI mode by providing a test file path to execute load testing scenarios without graphical interface overhead.

Instructions

Execute a JMeter test in non-GUI mode.

Args: test_file: Path to the JMeter test file (.jmx)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
test_fileYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'execute_jmeter_test_non_gui' tool. It is registered via the @mcp.tool() decorator and delegates the execution to the run_jmeter helper function, ensuring non-GUI mode.
    @mcp.tool()
    async def execute_jmeter_test_non_gui(test_file: str) -> str:
        """Execute a JMeter test in non-GUI mode.
    
        Args:
            test_file: Path to the JMeter test file (.jmx)
        """
        return await run_jmeter(test_file, non_gui=True)
  • Supporting function that contains the core logic for executing JMeter tests using subprocess. Handles file validation, command construction, logging, and output capture specifically for non-GUI mode.
    async def run_jmeter(test_file: str, non_gui: bool = True) -> str:
        """Run a JMeter test.
    
        Args:
            test_file: Path to the JMeter test file (.jmx)
            non_gui: Run in non-GUI mode (default: True)
    
        Returns:
            str: JMeter execution output
        """
        try:
            # Convert to absolute path
            test_file_path = Path(test_file).resolve()
            
            # Validate file exists and is a .jmx file
            if not test_file_path.exists():
                return f"Error: Test file not found: {test_file}"
            if not test_file_path.suffix == '.jmx':
                return f"Error: Invalid file type. Expected .jmx file: {test_file}"
    
            # Get JMeter binary path from environment
            jmeter_bin = os.getenv('JMETER_BIN', 'jmeter')
            java_opts = os.getenv('JMETER_JAVA_OPTS', '')
    
            # Log the JMeter binary path and Java options
            logger.info(f"JMeter binary path: {jmeter_bin}")
            logger.debug(f"Java options: {java_opts}")
    
            # Build command
            cmd = [str(Path(jmeter_bin).resolve())]
            
            if non_gui:
                cmd.extend(['-n'])
            cmd.extend(['-t', str(test_file_path)])
    
            # Log the full command for debugging
            logger.debug(f"Executing command: {' '.join(cmd)}")
            
            if non_gui:
                # For non-GUI mode, capture output
                result = subprocess.run(cmd, capture_output=True, text=True)
                
                # Log output for debugging
                logger.debug("Command output:")
                logger.debug(f"Return code: {result.returncode}")
                logger.debug(f"Stdout: {result.stdout}")
                logger.debug(f"Stderr: {result.stderr}")
    
                if result.returncode != 0:
                    return f"Error executing JMeter test:\n{result.stderr}"
                
                return result.stdout
            else:
                # For GUI mode, start process without capturing output
                subprocess.Popen(cmd)
                return "JMeter GUI launched successfully"
    
        except Exception as e:
            return f"Unexpected error: {str(e)}"
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 states the action ('Execute') but lacks details on permissions, side effects (e.g., whether it runs tests destructively), output format, error handling, or rate limits. This is inadequate for a tool that likely performs execution operations with potential impacts.

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 appropriately sized and front-loaded with the core purpose in the first sentence. The Args section is structured but minimal. It avoids waste, though it could be more detailed without losing conciseness. Every sentence serves a purpose, but the overall brevity limits completeness.

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?

Given the tool has an output schema (which reduces need to explain return values), no annotations, and low schema coverage, the description is minimally adequate. It covers the basic action and parameter, but lacks behavioral context, usage guidelines, and deeper parameter semantics, leaving gaps for effective agent use.

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 0%, so the description must compensate. It adds meaning by specifying the parameter 'test_file' as a 'Path to the JMeter test file (.jmx)', clarifying the expected format and file type. However, with only one parameter documented, it provides basic but incomplete context (e.g., no details on path validation or examples).

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 clearly states the verb ('Execute') and resource ('JMeter test in non-GUI mode'), making the purpose understandable. It distinguishes from the sibling tool 'execute_jmeter_test' by specifying 'non-GUI mode', though it doesn't explicitly contrast their differences. The purpose is specific but could be more explicit about sibling differentiation.

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 versus the sibling 'execute_jmeter_test', nor does it mention any prerequisites, contexts, or exclusions. Usage is implied by the name and mode specification, but explicit alternatives or conditions are missing, leaving gaps for agent decision-making.

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/Narasimhakatta/MCP-Server'

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