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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"planId": "<planId>",
"parentId": "<parentId>",
"script": "<script>"
},
"name": "add_jsr223_sampler"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | JSR223 Sampler | |
| planId | Yes | ||
| script | Yes | ||
| parentId | Yes | ||
| parameters | No | ||
| scriptLanguage | No | groovy |