Skip to main content
Glama
juliodelimas

jmeter-mcp-server

by juliodelimas

add_jsr223_sampler

Add a JSR223 sampler to a JMeter test plan to run a Groovy script as the sample itself. For unique or random data, prefer built-in functions to avoid script execution issues.

Instructions

Add a JSR223 Sampler under the given parent (usually a Thread Group), running a script as the sample itself. 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 Sampler
planIdYes
scriptYes
parentIdYes
parametersNo
scriptLanguageNogroovy

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.4.5

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries full behavioral burden. It discloses a critical failure mode: Groovy's incompatibility with very new Java versions (25+), which kills virtual users, and mentions the resulting 'warning' field. This is valuable transparency. However, it doesn't mention other behaviors like whether the script is compiled, side effects on the test plan, or response format beyond the warning.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded. The first sentence states the core purpose, followed by a crucial compatibility warning, then a practical alternative. Each sentence earns its place, and the length is appropriate for the complexity.

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?

The description covers the main purpose, the Java compatibility pitfall, and an alternative for common use cases. It mentions the 'warning' field in the result, which is helpful. However, it does not explain the 'parameters' field or the exact return value (no output schema), and it doesn't elaborate on prerequisites beyond the parent. Overall, it is sufficiently complete for an agent to call correctly in most scenarios.

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 explains 'parent' (the parent element), 'script' (the script to run), and implicitly 'scriptLanguage' by mentioning the Groovy default. However, it does not explain 'parameters', 'name', or 'planId' at all. These are not described in the schema either, so the description only partially covers parameter semantics.

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 Sampler under a parent and runs a script as the sample itself. It distinguishes this from sibling pre/post processors by specifying it is the sampler itself. The verb 'Add' plus the specific element name leaves no ambiguity about the action.

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

Usage Guidelines5/5

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

It provides explicit guidance to prefer built-in functions like ${__UUID}, ${__RandomString}, and ${__Random} for unique or random data, thereby telling when NOT to use this tool. It also implies when to use it: when a scripted sampler is needed. This is a clear alternative and usage condition.

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