Skip to main content
Glama

update_last_test_result

Amend a Jira test run item's current execution while preserving fields you do not pass, so status or comment edits do not reset the result.

Instructions

Amend the LAST (most recent) execution of a run item (PUT /testrun/{runKey}/testcase/{caseKey}/testresult). The endpoint REPLACES the execution instead of patching it: fields missing from the body are reset (verified live — an omitted status falls back to the project default 'Not Executed', executedBy becomes null, actualEndDate/executionDate jump to the server time; only comment, environment, executionTime, actualStartDate and scriptResults are kept by the API itself). To stop a comment edit from wiping the verdict, this tool therefore first READS the run item's current execution (one extra GET, two requests on builds without /testresults/page) and re-sends what you did not pass: status, executedBy, assignedTo, environment, comment, executionTime, actualStartDate, actualEndDate, iteration, version — exactly as the API returned them, never invented. So omitting a field means "keep it", not "clear it"; a value the API does not return cannot be preserved; and if the pre-read fails or the item has no execution yet, only your fields are sent. Older executions are unreachable here — record a new one with create_test_result, or edit any execution by id with update_test_result_by_id (internal API, when enabled). The test case should already be an item of the run; if it is not, the behavior is VERSION-SPECIFIC — some Server builds silently ADD it to the run as a new item (verified live: testCaseCount grows; the new item's POSITION in items[] is not the head and not the tail — it landed second of three and second of four in two separate runs, so do not rely on where it appears), others reject the call with 400/404. Default statuses: 'Not Executed', 'In Progress', 'Pass', 'Fail', 'Blocked' — case-sensitive internal names; instances may define custom ones. scriptResults carry per-step outcomes of a STEP_BY_STEP script as { index (0-based), status, comment? }. An overall status sent TOGETHER with scriptResults is stored as sent (verified live: 'Blocked' with three 'Pass' steps stored 'Blocked') and is NEVER derived from the step statuses — scriptResults without a status leave the execution at the project default ('Not Executed'), so pass status in the SAME call. Some older builds may instead ignore the overall status: read the result back with get_test_run_results rather than sending a second update_last_test_result, which replaces the whole execution. A scriptResults entry whose index is past the last step of the case is discarded silently (HTTP 200, no error). When the same test case is an item of the run several times (e.g. once per environment or assignee), disambiguate with matchEnvironment / matchUserKey; with no selector the API picks one of them itself — measured live it took the FIRST (lowest-id) twin and left the other untouched, so pass a selector whenever the case appears more than once. Selectors only SELECT an existing item — they never set a value, so pass environment as well if the result should carry it. matchUserKey matches executedBy/userKey, not assignedTo. If nothing matches, this build answers 400 "No test execution found …" or an empty-bodied HTTP 500 — the 500 was first seen with matchEnvironment, but other inputs produce it too, so its cause is undetermined; that empty-bodied 500 has been observed to write the execution and add a duplicate item anyway, so the write may or may not have happened — re-read with get_test_run_results instead of retrying. Returns the API response ({ id } of the amended execution on the audited build), or { updated: true, testRunKey, testCaseKey } when the API answers with an empty body.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusNoExecution status. Default statuses: 'Not Executed', 'In Progress', 'Pass', 'Fail', 'Blocked' — case-sensitive internal names; instances may define custom ones.
commentNoComment (HTML allowed)
versionNoJira release version name the execution belongs to, e.g. "2026.7" (case-sensitive)
iterationNoIteration name as configured in the project (case-sensitive), for runs executed in iterations
assignedToNoAssignee. Jira *user key* (e.g. 'JIRAUSER10000'), NOT a username or e-mail — resolve it with find_jira_user.
executedByNoExecutor. Jira *user key* (e.g. 'JIRAUSER10000'), NOT a username or e-mail — resolve it with find_jira_user.
issueLinksNoJira issue keys to link, e.g. ["PROJ-123"]
testRunKeyYesTest run (cycle) key, e.g. PROJ-R123 (PROJ-C123 on older instances)
environmentNoEnvironment name as configured in the project (case-sensitive), e.g. "Chrome"
testCaseKeyYesTest case key, e.g. PROJ-T123 — should already be one of the run's items
customFieldsNoCustom field values keyed by field name
matchUserKeyNoRun-item selector, sent as the 'userKey' QUERY parameter (never in the body): targets the run item by its executor's Jira user key, e.g. 'JIRAUSER10000'.
actualEndDateNoISO 8601
executionTimeNoExecution duration in milliseconds
scriptResultsNoPer-step results (STEP_BY_STEP scripts)
actualStartDateNoISO 8601, e.g. 2026-07-20T14:00:00Z
matchEnvironmentNoRun-item selector, sent as the 'environment' QUERY parameter (never in the body): targets the run item with this environment (case-sensitive). Distinct from the 'environment' body field, which sets the environment recorded on the result.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.5

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations at all, the description carries the full behavioral burden and does so in unusual depth: PUT-replaces-not-patches semantics with concrete evidence of what gets reset (status to 'Not Executed', executedBy to null, dates to server time), the pre-read that preserves omitted fields, the meaning of omission ('keep it', not 'clear it'), and the limits of preservation. It also discloses error behavior (400 'No test execution found', empty-bodied 500 that may still have written data) and version-specific side effects (silent item addition, undetermined position).

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 critical behavior (replacement semantics and the read-then-resend strategy) is front-loaded in the first two sentences, and nearly every sentence carries non-redundant behavioral information. It is nonetheless a dense wall of text with many parenthetical live-verification asides; it is long enough that an agent may skim past the selector and error-handling rules buried mid-paragraph.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 17-parameter mutation tool with no output schema and no annotations, the description covers what is missing elsewhere: return values ({ id } on the audited build, or { updated: true, testRunKey, testCaseKey } on an empty body), the multi-item disambiguation problem, and every known failure mode. Nothing an agent needs in order to call it safely appears absent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline would be 3, but the description adds semantics the schema cannot express: omitting a field means keep-not-clear, a value the API does not return cannot be preserved, matchUserKey matches executedBy/userKey and not assignedTo, selectors only select and never set a value (so pass `environment` too), status sent with scriptResults is stored as sent and never derived from step statuses, and an out-of-range scriptResults index is silently discarded. This is well beyond type-level documentation.

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 first sentence names the specific verb and resource ('Amend the LAST (most recent) execution of a run item') and even pins the endpoint (PUT /testrun/{runKey}/testcase/{caseKey}/testresult). It explicitly distinguishes itself from the two adjacent tools, create_test_result and update_test_result_by_id, so an agent can route correctly without opening schemas.

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 states when to use this tool versus the alternatives ('Older executions are unreachable here — record a new one with create_test_result, or edit any execution by id with update_test_result_by_id'), when to pass matchEnvironment/matchUserKey selectors, and what to do on failure ('re-read with get_test_run_results instead of retrying'). Conditions and exclusions are explicit rather than implied.

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

Deploy Server

Other Tools