Skip to main content
Glama

check_constraint

Read-onlyIdempotent

Test supplied prediction-market prices offline for no-arbitrage violations and find the cheapest basket that profits after fees.

Instructions

Check offline whether prices you supply violate a no-arbitrage relation, and price the cheapest exploiting basket after fees.

A pure calculation with no network calls: use it for hypothetical or
historical prices, and use check_constraint_live to fetch current quotes
instead. Returns violated, profitable_after_fees, the best basket (legs,
cost, guaranteed payoff, fees, gross and net edge), every candidate basket,
any missing quotes, and the assumptions behind the check (full fills at the
quoted prices, a correctly specified relation).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
makerNoPrice fees as resting maker orders instead of taker orders (default false). Maker fees are lower or zero, but a resting order may not fill.
quotesYesOne quote per contract, in the order the relation expects: implication (A, B) where A implies B; complement and same_event (A, B); exclusivity and event_sum every outcome.
relationYesBound to test: implication (A implies B, so P(A) <= P(B)), exclusivity (at most one outcome happens), complement (exactly one of two), same_event (one event quoted on two venues) or event_sum (exactly one of n). See list_relation_types.
contractsNoContracts bought on every leg (default 1). Fees scale with size.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed13 schema fields changedv1.2.2
    • changedInput schema / $defs / QuoteInput / description
      Previous value: -"Quotes for one contract, in dollars. A missing ask is derived from the other side's bid."New value: +"One contract's prices in dollars per contract. A missing ask is derived from the opposite side's bid."
    • changedInput schema / $defs / QuoteInput / properties / kalshi_maker_fees / description
      Previous value: -"Whether the Kalshi series charges maker fees."New value: +"Whether the Kalshi series charges maker fees, from get_quote."
    • changedInput schema / $defs / QuoteInput / properties / kalshi_multiplier / description
      Previous value: -"Kalshi series fee multiplier M (default 1)."New value: +"Kalshi series fee multiplier M, from get_quote (default 1)."
    • addedInput schema / $defs / QuoteInput / properties / market_id / description
      Added value: +"Label for this contract in the result, such as its ticker or market id."
    • addedInput schema / $defs / QuoteInput / properties / no_ask / description
      Added value: +"Best NO ask in dollars (0-1). If omitted, 1 - yes_bid is used."
    • addedInput schema / $defs / QuoteInput / properties / no_bid / description
      Added value: +"Best NO bid in dollars (0-1)."
    • addedInput schema / $defs / QuoteInput / properties / venue / description
      Added value: +"Venue whose fee schedule applies: 'kalshi' (default) or 'polymarket'."
    • addedInput schema / $defs / QuoteInput / properties / yes_ask / description
      Added value: +"Best YES ask in dollars (0-1). If omitted, 1 - no_bid is used."
    • addedInput schema / $defs / QuoteInput / properties / yes_bid / description
      Added value: +"Best YES bid in dollars (0-1)."
    • addedInput schema / properties / contracts / description
      Added value: +"Contracts bought on every leg (default 1). Fees scale with size."
    • addedInput schema / properties / maker / description
      Added value: +"Price fees as resting maker orders instead of taker orders (default false). Maker fees are lower or zero, but a resting order may not fill."
    • addedInput schema / properties / quotes / description
      Added value: +"One quote per contract, in the order the relation expects: implication (A, B) where A implies B; complement and same_event (A, B); exclusivity and event_sum every outcome."
    • addedInput schema / properties / relation / description
      Added value: +"Bound to test: implication (A implies B, so P(A) <= P(B)), exclusivity (at most one outcome happens), complement (exactly one of two), same_event (one event quoted on two venues) or event_sum (exactly one of n). See list_relation_types."
  2. First observedv1.2.1

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint and closed-world, and the description reinforces this with 'a pure calculation with no network calls'. It goes beyond annotations by stating the modeling assumptions behind the check (full fills at quoted prices, correctly specified relation), which is genuinely useful context an agent cannot get elsewhere. It does not, however, discuss failure modes or edge handling such as missing quotes beyond noting they are returned.

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?

Front-loaded with the core purpose and the sibling routing in the first two sentences, which is exactly the ordering an agent needs. The return-value enumeration is somewhat long given an output schema exists, but it is not padded with filler.

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?

With an output schema present, the description need not enumerate return values, yet it briefly does while also covering prerequisites, the offline constraint, the sibling alternative, and modeling assumptions. Nothing an agent needs to invoke it correctly is missing.

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 description coverage is 100%, including enum semantics for relation and detailed QuoteInput field docs, so the schema carries the parameter burden; baseline 3 applies. The prose adds no parameter syntax or format guidance beyond what the schema already provides.

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?

States a specific verb and resource ('check offline whether prices you supply violate a no-arbitrage relation') plus a secondary capability ('price the cheapest exploiting basket after fees'). It explicitly contrasts itself with the sibling check_constraint_live, so an agent can distinguish them without opening either schema.

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?

Gives an explicit when-to-use rule ('hypothetical or historical prices') and names the alternative plus the condition that selects it ('use check_constraint_live to fetch current quotes instead'). The same sentence also clarifies the offline/no-network constraint that bounds usage.

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