Triage a failure
The ostra_triage_failure tool on the Ostra MCP server — arguments, result, errors and examples.
https://ostra.testrelic.ai/mcp · ostra_triage_failureClassifies a failing test as flaky, product bug, test bug, environment or selector drift, with a confidence.
- Title
- Ostra Decision: Failure triage
- Access
- Full-access key. Read-only keys can list the tool but not call it.
- Cost
- $0.50 per 1M failures, same as REST. Cached answers are free.
- Hints
- readOnlyHint: true · destructiveHint: false · idempotentHint: true · openWorldHint: false
- Over REST
- POST /api/v1/predict
Once the Ostra MCP server is connected, your agent calls the tool with these arguments.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "ostra_triage_failure",
"arguments": {
"test_id": "checkout.spec.ts > applies coupon",
"run_id": "gha-18241",
"context": {
"framework": "playwright",
"capture_level": "full",
"error_message": "TimeoutError: locator.click: Timeout 30000ms exceeded.\n waiting for locator('#apply-coupon')",
"action": "click",
"locator": {
"strategy": "css"
},
"diff": {
"files_changed": 3,
"lines_added": 41,
"lines_removed": 12,
"touches_test_file": false,
"touches_selector_file": false,
"locator_values_removed": false
},
"dom": {
"locator_found": true
},
"memory": {
"runs_50": 40,
"flake_rate_50": 0.15,
"failed_count_50": 6,
"signature_repeat_count": 5
}
}
}
}
}curl https://ostra.testrelic.ai/mcp \
-H "Authorization: Bearer $OSTRA_API_KEY" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H 'MCP-Protocol-Version: 2025-06-18' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "ostra_triage_failure",
"arguments": {
"test_id": "checkout.spec.ts > applies coupon",
"run_id": "gha-18241",
"context": {
"framework": "playwright",
"capture_level": "full",
"error_message": "TimeoutError: locator.click: Timeout 30000ms exceeded.\n waiting for locator('\''#apply-coupon'\'')",
"action": "click",
"locator": {
"strategy": "css"
},
"diff": {
"files_changed": 3,
"lines_added": 41,
"lines_removed": 12,
"touches_test_file": false,
"touches_selector_file": false,
"locator_values_removed": false
},
"dom": {
"locator_found": true
},
"memory": {
"runs_50": 40,
"flake_rate_50": 0.15,
"failed_count_50": 6,
"signature_repeat_count": 5
}
}
}
}
}'import os
import requests
response = requests.post(
"https://ostra.testrelic.ai/mcp",
headers={
"Authorization": f"Bearer {os.environ['OSTRA_API_KEY']}",
"Accept": "application/json, text/event-stream",
"MCP-Protocol-Version": "2025-06-18",
},
json={
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "ostra_triage_failure",
"arguments": {
"test_id": "checkout.spec.ts > applies coupon",
"run_id": "gha-18241",
"context": {
"framework": "playwright",
"capture_level": "full",
"error_message": "TimeoutError: locator.click: Timeout 30000ms exceeded.\n waiting for locator('#apply-coupon')",
"action": "click",
"locator": {
"strategy": "css",
},
"diff": {
"files_changed": 3,
"lines_added": 41,
"lines_removed": 12,
"touches_test_file": False,
"touches_selector_file": False,
"locator_values_removed": False,
},
"dom": {
"locator_found": True,
},
"memory": {
"runs_50": 40,
"flake_rate_50": 0.15,
"failed_count_50": 6,
"signature_repeat_count": 5,
},
},
},
},
},
timeout=60,
)
response.raise_for_status()
print(response.json())const response = await fetch('https://ostra.testrelic.ai/mcp', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.OSTRA_API_KEY}`,
'Content-Type': 'application/json',
Accept: 'application/json, text/event-stream',
'MCP-Protocol-Version': '2025-06-18',
},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'tools/call',
params: {
name: 'ostra_triage_failure',
arguments: {
test_id: 'checkout.spec.ts > applies coupon',
run_id: 'gha-18241',
context: {
framework: 'playwright',
capture_level: 'full',
error_message: 'TimeoutError: locator.click: Timeout 30000ms exceeded.\n waiting for locator(\'#apply-coupon\')',
action: 'click',
locator: {
strategy: 'css',
},
diff: {
files_changed: 3,
lines_added: 41,
lines_removed: 12,
touches_test_file: false,
touches_selector_file: false,
locator_values_removed: false,
},
dom: {
locator_found: true,
},
memory: {
runs_50: 40,
flake_rate_50: 0.15,
failed_count_50: 6,
signature_repeat_count: 5,
},
},
},
},
}),
});
if (!response.ok) {
throw new Error(`Ostra ${response.status}: ${await response.text()}`);
}
console.log(await response.json());package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "ostra_triage_failure",
"arguments": {
"test_id": "checkout.spec.ts > applies coupon",
"run_id": "gha-18241",
"context": {
"framework": "playwright",
"capture_level": "full",
"error_message": "TimeoutError: locator.click: Timeout 30000ms exceeded.\n waiting for locator('#apply-coupon')",
"action": "click",
"locator": {
"strategy": "css"
},
"diff": {
"files_changed": 3,
"lines_added": 41,
"lines_removed": 12,
"touches_test_file": false,
"touches_selector_file": false,
"locator_values_removed": false
},
"dom": {
"locator_found": true
},
"memory": {
"runs_50": 40,
"flake_rate_50": 0.15,
"failed_count_50": 6,
"signature_repeat_count": 5
}
}
}
}
}`)
req, err := http.NewRequest("POST", "https://ostra.testrelic.ai/mcp", body)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("OSTRA_API_KEY"))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Accept", "application/json, text/event-stream")
req.Header.Set("MCP-Protocol-Version", "2025-06-18")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status)
fmt.Println(string(out))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class OstraExample {
public static void main(String[] args) throws Exception {
String body = """
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "ostra_triage_failure",
"arguments": {
"test_id": "checkout.spec.ts > applies coupon",
"run_id": "gha-18241",
"context": {
"framework": "playwright",
"capture_level": "full",
"error_message": "TimeoutError: locator.click: Timeout 30000ms exceeded.\\n waiting for locator('#apply-coupon')",
"action": "click",
"locator": {
"strategy": "css"
},
"diff": {
"files_changed": 3,
"lines_added": 41,
"lines_removed": 12,
"touches_test_file": false,
"touches_selector_file": false,
"locator_values_removed": false
},
"dom": {
"locator_found": true
},
"memory": {
"runs_50": 40,
"flake_rate_50": 0.15,
"failed_count_50": 6,
"signature_repeat_count": 5
}
}
}
}
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://ostra.testrelic.ai/mcp"))
.header("Authorization", "Bearer " + System.getenv("OSTRA_API_KEY"))
.header("Content-Type", "application/json")
.header("Accept", "application/json, text/event-stream")
.header("MCP-Protocol-Version", "2025-06-18")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}using System.Net.Http.Headers;
using System.Text;
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("OSTRA_API_KEY"));
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("text/event-stream"));
client.DefaultRequestHeaders.Add("MCP-Protocol-Version", "2025-06-18");
using var request = new HttpRequestMessage(HttpMethod.Post, "https://ostra.testrelic.ai/mcp");
request.Content = new StringContent(
"""
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "ostra_triage_failure",
"arguments": {
"test_id": "checkout.spec.ts > applies coupon",
"run_id": "gha-18241",
"context": {
"framework": "playwright",
"capture_level": "full",
"error_message": "TimeoutError: locator.click: Timeout 30000ms exceeded.\n waiting for locator('#apply-coupon')",
"action": "click",
"locator": {
"strategy": "css"
},
"diff": {
"files_changed": 3,
"lines_added": 41,
"lines_removed": 12,
"touches_test_file": false,
"touches_selector_file": false,
"locator_values_removed": false
},
"dom": {
"locator_found": true
},
"memory": {
"runs_50": 40,
"flake_rate_50": 0.15,
"failed_count_50": 6,
"signature_repeat_count": 5
}
}
}
}
}
""",
Encoding.UTF8,
"application/json");
using var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());require "net/http"
require "uri"
uri = URI("https://ostra.testrelic.ai/mcp")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("OSTRA_API_KEY")}"
request["Content-Type"] = "application/json"
request["Accept"] = "application/json, text/event-stream"
request["MCP-Protocol-Version"] = "2025-06-18"
request.body = <<~'JSON'
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "ostra_triage_failure",
"arguments": {
"test_id": "checkout.spec.ts > applies coupon",
"run_id": "gha-18241",
"context": {
"framework": "playwright",
"capture_level": "full",
"error_message": "TimeoutError: locator.click: Timeout 30000ms exceeded.\n waiting for locator('#apply-coupon')",
"action": "click",
"locator": {
"strategy": "css"
},
"diff": {
"files_changed": 3,
"lines_added": 41,
"lines_removed": 12,
"touches_test_file": false,
"touches_selector_file": false,
"locator_values_removed": false
},
"dom": {
"locator_found": true
},
"memory": {
"runs_50": 40,
"flake_rate_50": 0.15,
"failed_count_50": 6,
"signature_repeat_count": 5
}
}
}
}
}
JSON
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
puts response.code
puts response.body<?php
$ch = curl_init("https://ostra.testrelic.ai/mcp");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("OSTRA_API_KEY"),
"Content-Type: application/json",
"Accept: application/json, text/event-stream",
"MCP-Protocol-Version: 2025-06-18",
],
CURLOPT_POSTFIELDS => <<<'JSON'
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "ostra_triage_failure",
"arguments": {
"test_id": "checkout.spec.ts > applies coupon",
"run_id": "gha-18241",
"context": {
"framework": "playwright",
"capture_level": "full",
"error_message": "TimeoutError: locator.click: Timeout 30000ms exceeded.\n waiting for locator('#apply-coupon')",
"action": "click",
"locator": {
"strategy": "css"
},
"diff": {
"files_changed": 3,
"lines_added": 41,
"lines_removed": 12,
"touches_test_file": false,
"touches_selector_file": false,
"locator_values_removed": false
},
"dom": {
"locator_found": true
},
"memory": {
"runs_50": 40,
"flake_rate_50": 0.15,
"failed_count_50": 6,
"signature_repeat_count": 5
}
}
}
}
}
JSON,
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL;
echo $response, PHP_EOL;Headers
- mcp-protocol-version
- 2025-06-18
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [
{
"type": "text",
"text": "{\"id\":\"req_01JDXK4M7Q2N8R5T6V9W3Y1Z0A\",\"model\":\"ostra-lite@v.beta.5\",\"task\":\"triage\",\"cached\":false,\"billed\":{\"units\":1,\"costNano\":500,\"costUsd\":\"0.0000005\"},\"output\":{\"decision_id\":\"dec_5b0c9e2a7f3d4e18a6b2c9d0e1f4a7b3\",\"task\":\"triage\",\"decision\":\"flaky\",\"value\":\"flaky\",\"p\":0.83,\"probabilities\":{\"flaky\":0.83,\"product_bug\":0.06,\"test_bug\":0.05,\"environment\":0.04,\"selector_drift\":0.02},\"threshold\":0.6,\"defer_reason\":null,\"decided_by\":\"model\",\"rule\":null,\"model\":{\"release\":\"v.beta.5\",\"version\":\"1.4.0\",\"content_hash\":\"sha256:3f9a1c07d2e4b8a6\",\"gate_passed\":true},\"test_id\":\"checkout.spec.ts > applies coupon\",\"run_id\":\"gha-18241\",\"error_class\":\"timeout\",\"error_class_source\":\"error_message\"}}"
}
],
"structuredContent": {
"id": "req_01JDXK4M7Q2N8R5T6V9W3Y1Z0A",
"model": "ostra-lite@v.beta.5",
"task": "triage",
"cached": false,
"billed": {
"units": 1,
"costNano": 500,
"costUsd": "0.0000005"
},
"output": {
"decision_id": "dec_5b0c9e2a7f3d4e18a6b2c9d0e1f4a7b3",
"task": "triage",
"decision": "flaky",
"value": "flaky",
"p": 0.83,
"probabilities": {
"flaky": 0.83,
"product_bug": 0.06,
"test_bug": 0.05,
"environment": 0.04,
"selector_drift": 0.02
},
"threshold": 0.6,
"defer_reason": null,
"decided_by": "model",
"rule": null,
"model": {
"release": "v.beta.5",
"version": "1.4.0",
"content_hash": "sha256:3f9a1c07d2e4b8a6",
"gate_passed": true
},
"test_id": "checkout.spec.ts > applies coupon",
"run_id": "gha-18241",
"error_class": "timeout",
"error_class_source": "error_message"
}
},
"isError": false
}
}{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [
{
"type": "text",
"text": "Your balance ($0.00) does not cover this request ($0.0000005). Top up in the TestRelic Console."
}
],
"structuredContent": {
"error": {
"type": "insufficient_balance",
"message": "Your balance ($0.00) does not cover this request ($0.0000005). Top up in the TestRelic Console.",
"balance_usd": "0.00",
"cost_usd": "0.0000005"
}
},
"isError": true
}
}Arguments
test_idstringYour identifier for the failing test, echoed back in the answer. Use a stable name, e.g.
checkout.spec.ts > applies coupon.1–512 charsrun_idstringYour identifier for the CI run, echoed back.
1–512 charscontextobjectRequiredEvidence about the failure. Every field is optional except that
error_classorerror_messagemust be present. Missing evidence is treated as missing, never as zero, so send what you have.Show 10 child fieldsHide child fields
idstringYour own id for this failure record.
1–512 charsframeworkstringTest framework that produced the failure.
One ofplaywrightcypressjestseleniumcapture_levelstringHow much of the failure was captured (trace, DOM, network):
full,partialornone.One offullpartialnoneerror_classstringNormalized class of the error. Required unless you send
error_message.One oftimeoutlocator_not_foundstale_elementstrict_mode_violationassertion_mismatchnetwork_errorscript_errorunmappederror_messagestringThe raw error text. Used only to derive
error_classwhen you don’t send one; the answer reports which you used inerror_class_source.0–8,000 charsactionstringThe step that failed.
One ofclickfillnavigateassertwait_forapi_callscreenshotlocatorobjectThe locator the failing step used.
Show 1 child fieldHide child fields
strategystringHow the element was located.
One ofcssxpathtest_idtextrolenone
diffobjectThe code change the run tested.
Show 6 child fieldsHide child fields
files_changedintegerFiles changed in the commit or pull request under test.
0 to 1,000,000lines_addedintegerLines added.
0 to 1,000,000lines_removedintegerLines removed.
0 to 1,000,000touches_test_filebooleanThe change edits a test file.
touches_selector_filebooleanThe change edits a page object, locator map or other file that defines selectors.
locator_values_removedbooleanThe change removes or renames a locator value (an id, test id, class or text) that the test uses.
domobjectWhat the page looked like at failure time.
Show 1 child fieldHide child fields
locator_foundbooleanThe locator still matched an element in the captured DOM.
memoryobjectThis test’s recent history, over its last 50 runs at most.
Show 6 child fieldsHide child fields
runs_50integerRuns in the window.
0 to 50failed_count_50integerFailed runs in the window.
0 to 50passed_on_retry_50integerRuns that failed and then passed on retry.
0 to 50consecutive_failures_50integerFailures in a row up to this one.
0 to 50flake_rate_50numberShare of runs in the window that were flaky, 0–1.
0 to 1signature_repeat_countintegerHow many times this exact error signature has been seen before.
0 to 1,000,000
Result
content[0].text holds the answer as text; structuredContent holds it as JSON:
idstringRequest id.
modelstringModel and release, e.g.
ostra-lite@v.beta.5.taskstringThe task.
cachedbooleanAnswered from the 24-hour cache.
billedobjectWhat this request cost. Cached answers cost 0.
Show 3 child fieldsHide child fields
unitsintegerBillable units: 1 per failure (triage), 1 per request (test impact), 1 per locator (selector survival). 0 for a cached answer.
costNanointegerCost in nano-dollars (1 USD = 1,000,000,000).
costUsdstringCost in USD as an exact decimal string, e.g.
"0.0000005".
outputobjectThe task’s answer, the same shape as
/predict.
Errors
Billing, validation, rate-limit and permission problems come back as a normal result with isError: true and structuredContent.error (type, message), the same types as the REST errors. Authentication failures are HTTP 401/403 before any JSON-RPC.
MCP server
Connect Claude Code, Cursor, VS Code, the Claude API or any MCP client to the Ostra MCP server — URL, transport, authentication, protocol versions, tools, errors and long-running calls.
MCPSelect impacted tests
The ostra_select_impacted_tests tool on the Ostra MCP server — arguments, result, errors and examples.