Select impacted tests
The ostra_select_impacted_tests tool on the Ostra MCP server — arguments, result, errors and examples.
https://ostra.testrelic.ai/mcp · ostra_select_impacted_testsGiven a code change and candidate tests, returns the tests the change is likely to affect, best first.
- Title
- Ostra Decision: Test impact
- Access
- Full-access key. Read-only keys can list the tool but not call it.
- Cost
- $2.00 per 1M requests, whatever the number of candidates.
- 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_select_impacted_tests",
"arguments": {
"diff": {
"files_changed": 2,
"lines_added": 87,
"lines_removed": 14,
"touches_test_file": false,
"touches_selector_file": false
},
"candidates": [
{
"test_id": "checkout.spec.ts > applies coupon",
"co_change_rate": 0.62,
"historical_fail_rate": 0.08
},
{
"test_id": "checkout.spec.ts > rejects expired coupon",
"co_change_rate": 0.58,
"historical_fail_rate": 0.03
},
{
"test_id": "search.spec.ts > filters by brand",
"co_change_rate": 0.02,
"historical_fail_rate": 0.04
}
]
}
}
}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_select_impacted_tests",
"arguments": {
"diff": {
"files_changed": 2,
"lines_added": 87,
"lines_removed": 14,
"touches_test_file": false,
"touches_selector_file": false
},
"candidates": [
{
"test_id": "checkout.spec.ts > applies coupon",
"co_change_rate": 0.62,
"historical_fail_rate": 0.08
},
{
"test_id": "checkout.spec.ts > rejects expired coupon",
"co_change_rate": 0.58,
"historical_fail_rate": 0.03
},
{
"test_id": "search.spec.ts > filters by brand",
"co_change_rate": 0.02,
"historical_fail_rate": 0.04
}
]
}
}
}'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_select_impacted_tests",
"arguments": {
"diff": {
"files_changed": 2,
"lines_added": 87,
"lines_removed": 14,
"touches_test_file": False,
"touches_selector_file": False,
},
"candidates": [
{
"test_id": "checkout.spec.ts > applies coupon",
"co_change_rate": 0.62,
"historical_fail_rate": 0.08,
},
{
"test_id": "checkout.spec.ts > rejects expired coupon",
"co_change_rate": 0.58,
"historical_fail_rate": 0.03,
},
{
"test_id": "search.spec.ts > filters by brand",
"co_change_rate": 0.02,
"historical_fail_rate": 0.04,
},
],
},
},
},
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_select_impacted_tests',
arguments: {
diff: {
files_changed: 2,
lines_added: 87,
lines_removed: 14,
touches_test_file: false,
touches_selector_file: false,
},
candidates: [
{
test_id: 'checkout.spec.ts > applies coupon',
co_change_rate: 0.62,
historical_fail_rate: 0.08,
},
{
test_id: 'checkout.spec.ts > rejects expired coupon',
co_change_rate: 0.58,
historical_fail_rate: 0.03,
},
{
test_id: 'search.spec.ts > filters by brand',
co_change_rate: 0.02,
historical_fail_rate: 0.04,
},
],
},
},
}),
});
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_select_impacted_tests",
"arguments": {
"diff": {
"files_changed": 2,
"lines_added": 87,
"lines_removed": 14,
"touches_test_file": false,
"touches_selector_file": false
},
"candidates": [
{
"test_id": "checkout.spec.ts > applies coupon",
"co_change_rate": 0.62,
"historical_fail_rate": 0.08
},
{
"test_id": "checkout.spec.ts > rejects expired coupon",
"co_change_rate": 0.58,
"historical_fail_rate": 0.03
},
{
"test_id": "search.spec.ts > filters by brand",
"co_change_rate": 0.02,
"historical_fail_rate": 0.04
}
]
}
}
}`)
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_select_impacted_tests",
"arguments": {
"diff": {
"files_changed": 2,
"lines_added": 87,
"lines_removed": 14,
"touches_test_file": false,
"touches_selector_file": false
},
"candidates": [
{
"test_id": "checkout.spec.ts > applies coupon",
"co_change_rate": 0.62,
"historical_fail_rate": 0.08
},
{
"test_id": "checkout.spec.ts > rejects expired coupon",
"co_change_rate": 0.58,
"historical_fail_rate": 0.03
},
{
"test_id": "search.spec.ts > filters by brand",
"co_change_rate": 0.02,
"historical_fail_rate": 0.04
}
]
}
}
}
""";
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_select_impacted_tests",
"arguments": {
"diff": {
"files_changed": 2,
"lines_added": 87,
"lines_removed": 14,
"touches_test_file": false,
"touches_selector_file": false
},
"candidates": [
{
"test_id": "checkout.spec.ts > applies coupon",
"co_change_rate": 0.62,
"historical_fail_rate": 0.08
},
{
"test_id": "checkout.spec.ts > rejects expired coupon",
"co_change_rate": 0.58,
"historical_fail_rate": 0.03
},
{
"test_id": "search.spec.ts > filters by brand",
"co_change_rate": 0.02,
"historical_fail_rate": 0.04
}
]
}
}
}
""",
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_select_impacted_tests",
"arguments": {
"diff": {
"files_changed": 2,
"lines_added": 87,
"lines_removed": 14,
"touches_test_file": false,
"touches_selector_file": false
},
"candidates": [
{
"test_id": "checkout.spec.ts > applies coupon",
"co_change_rate": 0.62,
"historical_fail_rate": 0.08
},
{
"test_id": "checkout.spec.ts > rejects expired coupon",
"co_change_rate": 0.58,
"historical_fail_rate": 0.03
},
{
"test_id": "search.spec.ts > filters by brand",
"co_change_rate": 0.02,
"historical_fail_rate": 0.04
}
]
}
}
}
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_select_impacted_tests",
"arguments": {
"diff": {
"files_changed": 2,
"lines_added": 87,
"lines_removed": 14,
"touches_test_file": false,
"touches_selector_file": false
},
"candidates": [
{
"test_id": "checkout.spec.ts > applies coupon",
"co_change_rate": 0.62,
"historical_fail_rate": 0.08
},
{
"test_id": "checkout.spec.ts > rejects expired coupon",
"co_change_rate": 0.58,
"historical_fail_rate": 0.03
},
{
"test_id": "search.spec.ts > filters by brand",
"co_change_rate": 0.02,
"historical_fail_rate": 0.04
}
]
}
}
}
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_01JDXK5A1B2C3D4E5F6G7H8J9K\",\"model\":\"ostra-lite@v.beta.5\",\"task\":\"test_impact\",\"cached\":false,\"billed\":{\"units\":1,\"costNano\":2000,\"costUsd\":\"0.000002\"},\"output\":{\"decisions\":[{\"decision_id\":\"dec_1a2b3c4d5e6f708192a3b4c5d6e7f809\",\"task\":\"test_impact\",\"decision\":\"impacted\",\"value\":\"impacted\",\"p\":0.91,\"probabilities\":{\"impacted\":0.91,\"not_impacted\":0.09},\"threshold\":0.55,\"defer_reason\":null,\"decided_by\":\"model\",\"rule\":null,\"model\":{\"release\":\"v.beta.5\",\"version\":\"1.1.2\",\"content_hash\":\"sha256:a07be3315c9d4f12\",\"gate_passed\":true},\"test_id\":\"checkout.spec.ts > applies coupon\"},{\"decision_id\":\"dec_2b3c4d5e6f708192a3b4c5d6e7f8091a\",\"task\":\"test_impact\",\"decision\":\"impacted\",\"value\":\"impacted\",\"p\":0.86,\"probabilities\":{\"impacted\":0.86,\"not_impacted\":0.14},\"threshold\":0.55,\"defer_reason\":null,\"decided_by\":\"model\",\"rule\":null,\"model\":{\"release\":\"v.beta.5\",\"version\":\"1.1.2\",\"content_hash\":\"sha256:a07be3315c9d4f12\",\"gate_passed\":true},\"test_id\":\"checkout.spec.ts > rejects expired coupon\"},{\"decision_id\":\"dec_3c4d5e6f708192a3b4c5d6e7f8091a2b\",\"task\":\"test_impact\",\"decision\":\"not_impacted\",\"value\":\"not_impacted\",\"p\":0.97,\"probabilities\":{\"impacted\":0.03,\"not_impacted\":0.97},\"threshold\":0.55,\"defer_reason\":null,\"decided_by\":\"model\",\"rule\":null,\"model\":{\"release\":\"v.beta.5\",\"version\":\"1.1.2\",\"content_hash\":\"sha256:a07be3315c9d4f12\",\"gate_passed\":true},\"test_id\":\"search.spec.ts > filters by brand\"}],\"impacted\":[\"checkout.spec.ts > applies coupon\",\"checkout.spec.ts > rejects expired coupon\"],\"selection\":\"model\"}}"
}
],
"structuredContent": {
"id": "req_01JDXK5A1B2C3D4E5F6G7H8J9K",
"model": "ostra-lite@v.beta.5",
"task": "test_impact",
"cached": false,
"billed": {
"units": 1,
"costNano": 2000,
"costUsd": "0.000002"
},
"output": {
"decisions": [
{
"decision_id": "dec_1a2b3c4d5e6f708192a3b4c5d6e7f809",
"task": "test_impact",
"decision": "impacted",
"value": "impacted",
"p": 0.91,
"probabilities": {
"impacted": 0.91,
"not_impacted": 0.09
},
"threshold": 0.55,
"defer_reason": null,
"decided_by": "model",
"rule": null,
"model": {
"release": "v.beta.5",
"version": "1.1.2",
"content_hash": "sha256:a07be3315c9d4f12",
"gate_passed": true
},
"test_id": "checkout.spec.ts > applies coupon"
},
{
"decision_id": "dec_2b3c4d5e6f708192a3b4c5d6e7f8091a",
"task": "test_impact",
"decision": "impacted",
"value": "impacted",
"p": 0.86,
"probabilities": {
"impacted": 0.86,
"not_impacted": 0.14
},
"threshold": 0.55,
"defer_reason": null,
"decided_by": "model",
"rule": null,
"model": {
"release": "v.beta.5",
"version": "1.1.2",
"content_hash": "sha256:a07be3315c9d4f12",
"gate_passed": true
},
"test_id": "checkout.spec.ts > rejects expired coupon"
},
{
"decision_id": "dec_3c4d5e6f708192a3b4c5d6e7f8091a2b",
"task": "test_impact",
"decision": "not_impacted",
"value": "not_impacted",
"p": 0.97,
"probabilities": {
"impacted": 0.03,
"not_impacted": 0.97
},
"threshold": 0.55,
"defer_reason": null,
"decided_by": "model",
"rule": null,
"model": {
"release": "v.beta.5",
"version": "1.1.2",
"content_hash": "sha256:a07be3315c9d4f12",
"gate_passed": true
},
"test_id": "search.spec.ts > filters by brand"
}
],
"impacted": [
"checkout.spec.ts > applies coupon",
"checkout.spec.ts > rejects expired coupon"
],
"selection": "model"
}
},
"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
diffobjectRequiredThe code change to evaluate.
Show 5 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.
candidatesarray of objectsRequiredThe tests that could be affected. One request is billed once, whatever the number of candidates.
1–2,000 itemsShow 3 child fieldsHide child fields
test_idstringRequiredYour identifier for the test.
1–512 charsco_change_ratenumberHow often this test’s files change together with the changed files, 0–1.
0 to 1historical_fail_ratenumberThe test’s historical failure rate, 0–1.
0 to 1
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.