Select impacted tests

The ostra_select_impacted_tests tool on the Ostra MCP server — arguments, result, errors and examples.

MCPhttps://ostra.testrelic.ai/mcp · ostra_select_impacted_tests

Given 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

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
        }
      ]
    }
  }
}
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
  }
}

Arguments

  • diffobjectRequired

    The code change to evaluate.

    Show 5 child fields
    • files_changedinteger

      Files changed in the commit or pull request under test.

      0 to 1,000,000
    • lines_addedinteger

      Lines added.

      0 to 1,000,000
    • lines_removedinteger

      Lines removed.

      0 to 1,000,000
    • touches_test_fileboolean

      The change edits a test file.

    • touches_selector_fileboolean

      The change edits a page object, locator map or other file that defines selectors.

  • candidatesarray of objectsRequired

    The tests that could be affected. One request is billed once, whatever the number of candidates.

    1–2,000 items
    Show 3 child fields
    • test_idstringRequired

      Your identifier for the test.

      1–512 chars
    • co_change_ratenumber

      How often this test’s files change together with the changed files, 0–1.

      0 to 1
    • historical_fail_ratenumber

      The test’s historical failure rate, 0–1.

      0 to 1

Result

content[0].text holds the answer as text; structuredContent holds it as JSON:

  • idstring

    Request id.

  • modelstring

    Model and release, e.g. ostra-lite@v.beta.5.

  • taskstring

    The task.

  • cachedboolean

    Answered from the 24-hour cache.

  • billedobject

    What this request cost. Cached answers cost 0.

    Show 3 child fields
    • unitsinteger

      Billable units: 1 per failure (triage), 1 per request (test impact), 1 per locator (selector survival). 0 for a cached answer.

    • costNanointeger

      Cost in nano-dollars (1 USD = 1,000,000,000).

    • costUsdstring

      Cost in USD as an exact decimal string, e.g. "0.0000005".

  • outputobject

    The 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.

Was this page helpful?