Skip to main content
Glama

Peek-safe A/B verdict

ab_test
Read-onlyIdempotent

Compares two cumulative binary-outcome experiment arms to determine whether either success rate is higher, using beta-binomial confidence sequences for repeated looks.

Instructions

Compare two cumulative binary-outcome experiment arms to decide whether either success rate is higher. Use for conversions or other Bernoulli outcomes with constant conditional success probabilities, not an ordered numeric metric. The beta-binomial confidence sequences split alpha across arms, allowing repeated looks under the stated sampling assumptions. Do not substitute selected windows, continuous returns or changing-probability outcomes. Returns decided, winner (label or null), reading, and each label's successes/n/rate/interval; rates and bounds are fractions in [0,1]. Zero totals are allowed and leave the test undecided. No winner means overlapping intervals, not equal rates. Invalid counts (including successes > total) or duplicate/reserved labels return a tool error. Example: {"a_successes":40,"a_total":100,"b_successes":55,"b_total":100}.

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": {
      "a_successes": "<a_successes>",
      "a_total": "<a_total>",
      "b_successes": "<b_successes>",
      "b_total": "<b_total>"
    },
    "name": "ab_test"
  }
}

Input Schema

NameRequiredDescriptionDefault
alphaNoTotal error budget shared by both confidence sequences; default 0.05 means 5%, split equally between arms. Must be strictly between 0 and 1.
a_labelNoArm A's output key and possible winner label; default A. Must differ from b_label and not replace result keys such as decided, winner or reading.A
a_totalYesCumulative trials in arm A, including successes and failures. Zero is valid and returns an undecided result.
b_labelNoArm B's output key and possible winner label; default B. Must differ from a_label and not replace result keys such as alpha, method or validity.B
b_totalYesCumulative trials in arm B, including successes and failures. Counts must use the same pre-defined experiment and outcome as arm A.
a_successesYesCumulative successful binary outcomes in arm A, an integer from 0 through a_total; do not supply a percentage.
b_successesYesCumulative successful binary outcomes in arm B, an integer from 0 through b_total; do not supply a percentage.

Output Schema

NameRequiredDescriptionDefault
alphaNoTotal error budget split across the arms, as a fraction.
errorNoA string on tool error, or a successful arm object when the caller labels that arm error; inspect MCP isError.
methodNoConfidence-sequence method and reference.
winnerNoWinning caller-supplied arm label; null when undecided. Null means unavailable or not applicable, never zero.
decidedNoWhether the two confidence sequences are disjoint.
readingNoInterpretation of the current comparison.
validityNoGuarantees are conditional on the Bernoulli sampling model.
guaranteeNoConditional confidence-sequence guarantee; not a market-performance claim.
assumptionsNoOrdered statements or identifiers.
safe_to_peekNoRepeated looks are allowed only under the stated Bernoulli assumptions.
what_would_decide_itNoQualitative guidance for an undecided comparison with data in both arms.
observed_difference_ppNoB's observed success rate minus A's, in percentage points; present only for undecided nonempty arms.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.4.3
    • removedOutput schema / additionalProperties
      Removed value: -true
    • addedOutput schema / anyOf
      Added value: +[
      +  {
      +    "additionalProperties": {
      +      "additionalProperties": false,
      +      "description": "One experiment arm, stored under its caller-supplied label.",
      +      "properties": {
      +        "interval": {
      +          "description": "Lower and upper confidence-sequence bounds.",
      +          "items": {
      +            "description": "Success-probability bound as a fraction.",
      +            "type": "number"
      +          },
      +          "maxItems": 2,
      +          "minItems": 2,
      +          "type": "array"
      +        },
      +        "n": {
      +          "description": "Cumulative trials, including failures.",
      +          "minimum": 0,
      +          "type": "integer"
      +        },
      +        "rate": {
      +          "anyOf": [
      +            {
      +              "description": "Observed success fraction; null when n is zero.",
      +              "type": "number"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "description": "Observed success fraction; null when n is zero. Null means unavailable or not applicable, never zero."
      +        },
      +        "successes": {
      +          "description": "Cumulative successful binary outcomes.",
      +          "minimum": 0,
      +          "type": "integer"
      +        }
      +      },
      +      "required": [
      +        "successes",
      +        "n",
      +        "rate",
      +        "interval"
      +      ],
      +      "type": "object"
      +    },
      +    "properties": {
      +      "alpha": {},
      +      "assumptions": {},
      +      "decided": {},
      +      "guarantee": {},
      +      "method": {},
      +      "observed_difference_pp": {},
      +      "reading": {},
      +      "safe_to_peek": {},
      +      "validity": {},
      +      "what_would_decide_it": {},
      +      "winner": {}
      +    },
      +    "required": [
      +      "decided",
      +      "winner",
      +      "reading",
      +      "alpha",
      +      "safe_to_peek",
      +      "validity",
      +      "guarantee",
      +      "assumptions",
      +      "method"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": false,
      +    "description": "Existing tool-error payload; no successful result fields are implied.",
      +    "properties": {
      +      "error": {
      +        "description": "Validation or computation failure message; inspect MCP isError or the HTTP status.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "error"
      +    ],
      +    "type": "object"
      +  }
      +]
    • changedOutput schema / description
      Previous value: -"Tool-specific result object described in each tool's description. Check status/ok/state, reading, validity and limits before using numbers. MCP returns this object in structuredContent and JSON text; invalid input returns isError=true with an error field. No tool fetches sources or executes trades."New value: +"Two dynamically named arm objects plus comparison metadata. A and B are defaults, not fixed output keys. Tool errors retain the separate error-message shape."
    • addedOutput schema / properties
      Added value: +{
      +  "alpha": {
      +    "description": "Total error budget split across the arms, as a fraction.",
      +    "type": "number"
      +  },
      +  "assumptions": {
      +    "description": "Ordered statements or identifiers.",
      +    "items": {
      +      "description": "One retained statement or identifier.",
      +      "type": "string"
      +    },
      +    "type": "array"
      +  },
      +  "decided": {
      +    "description": "Whether the two confidence sequences are disjoint.",
      +    "type": "boolean"
      +  },
      +  "error": {
      +    "anyOf": [
      +      {
      +        "description": "Validation or computation failure message; inspect MCP isError or the HTTP status.",
      +        "type": "string"
      +      },
      +      {
      +        "additionalProperties": false,
      +        "description": "One experiment arm, stored under its caller-supplied label.",
      +        "properties": {
      +          "interval": {
      +            "description": "Lower and upper confidence-sequence bounds.",
      +            "items": {
      +              "description": "Success-probability bound as a fraction.",
      +              "type": "number"
      +            },
      +            "maxItems": 2,
      +            "minItems": 2,
      +            "type": "array"
      +          },
      +          "n": {
      +            "description": "Cumulative trials, including failures.",
      +            "minimum": 0,
      +            "type": "integer"
      +          },
      +          "rate": {
      +            "anyOf": [
      +              {
      +                "description": "Observed success fraction; null when n is zero.",
      +                "type": "number"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ],
      +            "description": "Observed success fraction; null when n is zero. Null means unavailable or not applicable, never zero."
      +          },
      +          "successes": {
      +            "description": "Cumulative successful binary outcomes.",
      +            "minimum": 0,
      +            "type": "integer"
      +          }
      +        },
      +        "required": [
      +          "successes",
      +          "n",
      +          "rate",
      +          "interval"
      +        ],
      +        "type": "object"
      +      }
      +    ],
      +    "description": "A string on tool error, or a successful arm object when the caller labels that arm error; inspect MCP isError."
      +  },
      +  "guarantee": {
      +    "description": "Conditional confidence-sequence guarantee; not a market-performance claim.",
      +    "type": "string"
      +  },
      +  "method": {
      +    "description": "Confidence-sequence method and reference.",
      +    "type": "string"
      +  },
      +  "observed_difference_pp": {
      +    "description": "B's observed success rate minus A's, in percentage points; present only for undecided nonempty arms.",
      +    "type": "number"
      +  },
      +  "reading": {
      +    "description": "Interpretation of the current comparison.",
      +    "type": "string"
      +  },
      +  "safe_to_peek": {
      +    "const": true,
      +    "description": "Repeated looks are allowed only under the stated Bernoulli assumptions.",
      +    "type": "boolean"
      +  },
      +  "validity": {
      +    "const": "conditional_on_bernoulli_model",
      +    "description": "Guarantees are conditional on the Bernoulli sampling model.",
      +    "type": "string"
      +  },
      +  "what_would_decide_it": {
      +    "description": "Qualitative guidance for an undecided comparison with data in both arms.",
      +    "type": "string"
      +  },
      +  "winner": {
      +    "anyOf": [
      +      {
      +        "description": "Winning caller-supplied arm label; null when undecided.",
      +        "type": "string"
      +      },
      +      {
      +        "type": "null"
      +      }
      +    ],
      +    "description": "Winning caller-supplied arm label; null when undecided. Null means unavailable or not applicable, never zero."
      +  }
      +}
  2. Changed11 schema fields changedv0.4.3-glama.1
    • addedInput schema / properties / a_label / default
      Added value: +"A"
    • addedInput schema / properties / a_label / description
      Added value: +"Arm A's output key and possible winner label; default A. Must differ from b_label and not replace result keys such as decided, winner or reading."
    • addedInput schema / properties / a_successes / description
      Added value: +"Cumulative successful binary outcomes in arm A, an integer from 0 through a_total; do not supply a percentage."
    • addedInput schema / properties / a_total / description
      Added value: +"Cumulative trials in arm A, including successes and failures. Zero is valid and returns an undecided result."
    • addedInput schema / properties / alpha / default
      Added value: +0.05
    • addedInput schema / properties / alpha / description
      Added value: +"Total error budget shared by both confidence sequences; default 0.05 means 5%, split equally between arms. Must be strictly between 0 and 1."
    • addedInput schema / properties / b_label / default
      Added value: +"B"
    • addedInput schema / properties / b_label / description
      Added value: +"Arm B's output key and possible winner label; default B. Must differ from a_label and not replace result keys such as alpha, method or validity."
    • addedInput schema / properties / b_successes / description
      Added value: +"Cumulative successful binary outcomes in arm B, an integer from 0 through b_total; do not supply a percentage."
    • addedInput schema / properties / b_total / description
      Added value: +"Cumulative trials in arm B, including successes and failures. Counts must use the same pre-defined experiment and outcome as arm A."
    • addedOutput schema / description
      Added value: +"Tool-specific result object described in each tool's description. Check status/ok/state, reading, validity and limits before using numbers. MCP returns this object in structuredContent and JSON text; invalid input returns isError=true with an error field. No tool fetches sources or executes trades."
  3. Changed20 schema fields changedv0.4.1
    • addedInput schema / properties / a_label / maxLength
      Added value: +128
    • addedInput schema / properties / a_label / minLength
      Added value: +1
    • removedInput schema / properties / a_successes / description
      Removed value: -"conversions in arm A"
    • addedInput schema / properties / a_successes / maximum
      Added value: +1000000000000
    • addedInput schema / properties / a_successes / minimum
      Added value: +0
    • removedInput schema / properties / a_total / description
      Removed value: -"total observations in arm A"
    • addedInput schema / properties / a_total / maximum
      Added value: +1000000000000
    • addedInput schema / properties / a_total / minimum
      Added value: +0
    • removedInput schema / properties / alpha / description
      Removed value: -"error budget, default 0.05"
    • addedInput schema / properties / alpha / exclusiveMaximum
      Added value: +1
    • addedInput schema / properties / alpha / exclusiveMinimum
      Added value: +0
    • addedInput schema / properties / b_label / maxLength
      Added value: +128
    • addedInput schema / properties / b_label / minLength
      Added value: +1
    • removedInput schema / properties / b_successes / description
      Removed value: -"conversions in arm B"
    • addedInput schema / properties / b_successes / maximum
      Added value: +1000000000000
    • addedInput schema / properties / b_successes / minimum
      Added value: +0
    • removedInput schema / properties / b_total / description
      Removed value: -"total observations in arm B"
    • addedInput schema / properties / b_total / maximum
      Added value: +1000000000000
    • addedInput schema / properties / b_total / minimum
      Added value: +0
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "type": "object"
      +}
  4. First observedv0.1.2

TDQS

A4.1/5.0
Behavior5/5

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

Annotations already declare readOnly, idempotent, non-destructive, closed-world, so the safety profile is covered; the description goes well beyond by disclosing the alpha-splitting across arms, that repeated looks are valid under the sampling assumptions, that zero totals yield an undecided result, that a null winner means overlapping intervals rather than equal rates, and that invalid counts or duplicate/reserved labels produce a tool error. These are exactly the behavioral traits an agent cannot read off the annotations.

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 content is front-loaded: purpose first, then scope exclusions, then mechanism, then return shape, then edge cases and an example. It is a single dense paragraph and a few clauses duplicate schema text (invalid counts, reserved labels). Slightly long, but nearly every sentence carries information.

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 7-parameter statistical verdict tool with an output schema and full annotation coverage, the description supplies the sampling assumptions, the repeated-look guarantee, the output field list, and the failure modes. An agent has everything needed to call it correctly and to interpret an undecided result.

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

Parameters3/5

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

Schema coverage is 100% and the schema already documents alpha splitting, zero-total validity, label distinctness and reserved keys, so the description largely restates structured fields. It adds marginal new meaning by noting that successes greater than total returns a tool error and by giving a concrete example payload. With the schema doing the heavy lifting, the baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a precise verb+resource+decision: 'Compare two cumulative binary-outcome experiment arms to decide whether either success rate is higher.' It also fences off what the tool is not (ordered numeric metrics, continuous returns, changing-probability outcomes), which sharply bounds the domain. It does not name any sibling tool, so an agent must infer routing from the domain constraints rather than from explicit alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

'Use for conversions or other Bernoulli outcomes with constant conditional success probabilities' states the positive condition, and 'Do not substitute selected windows, continuous returns or changing-probability outcomes' plus 'not an ordered numeric metric' states exclusions. This is clear when-to-use/when-not guidance. No sibling tool is named as an alternative, which is the only gap versus a 5.

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