Skip to main content
Glama
juliodelimas

jmeter-mcp-server

by juliodelimas

add_jsr223_preprocessor

Add a JSR223 preprocessor to an HTTP sampler or Thread Group, running a script before each sample to set variables or modify requests.

Instructions

Add a JSR223 PreProcessor under an HTTP sampler (or a Thread Group, to apply to every sampler in it), running a script before the sample. Scripts default to Groovy, which only works when JMeter runs on a compatible Java (17 is the safe choice; the Groovy bundled with JMeter 5.6.x fails on very new Java such as 25+, killing each virtual user on its first script run) - the result carries a "warning" field when this server detects a mismatch. For unique or random data, prefer the built-in functions ${__UUID}, ${__RandomString} and ${__Random}, which need no script at all.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoJSR223 PreProcessor
planIdYes
scriptYes
parentIdYes
parametersNo
scriptLanguageNogroovy

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.4.5

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does well: it discloses the pre-sample execution timing, the Groovy/Java compatibility risk that can kill virtual users, and the presence of a 'warning' field in the result. This goes beyond basic mutation and adds critical operational context.

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, dense sentence that front-loads the core purpose and usage. It includes a practical recommendation about built-in functions without padding. Slightly long but efficient and easy to parse.

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 tool with 6 parameters and no output schema, the description covers the essential behavior, placement, and known pitfalls. It mentions the warning field and compatibility issues, which are important for correct invocation. Missing parameter explanations are a minor gap given the tool's context.

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 clarifies 'script' and 'scriptLanguage' (default groovy, with a compatibility caveat) but leaves 'planId', 'parentId', 'name', and 'parameters' unexplained. This is a partial improvement over the schema, but not sufficient for full parameter clarity.

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 tool adds a JSR223 PreProcessor, specifies where it can be attached (HTTP sampler or Thread Group), and describes its function (running a script before the sample). It also distinguishes it from related tools like postprocessor and sampler by the explicit 'PreProcessor' and timing context.

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?

Provides explicit guidance on when to use built-in functions instead of scripts, and warns about Java/Groovy compatibility. However, it does not directly compare against sibling tools like add_jsr223_postprocessor or add_jsr223_sampler, leaving some inference to the agent.

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