Skip to main content
Glama

check_constraint

Read-onlyIdempotent

Calculate price-bound violations and basket economics for supplied quotes and a relation, returning best basket, fees, and net edge for hypothetical or historical prices.

Instructions

Calculate a price-bound violation and basket economics conditional on the relation you supply.

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, conditional payoff bound, 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). The assessment object marks
relation_verified=false, execution_verified=false and conditional_on_relation=true:
this tool does not verify resolution rules, order-book depth or full fills.
Quote prices must be finite and in [0, 1]; prices used to calculate fees must
be strictly between 0 and 1. Each (venue, market_id) must be unique.

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": {
      "relation": "<relation>",
      "quotes": "<quotes>"
    },
    "name": "check_constraint"
  }
}

Input 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.
contractsNoFinite, positive contracts bought on every leg (default 1). Fees scale with size.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.3.0
    • changedInput schema / properties / contracts / description
      Previous value: -"Contracts bought on every leg (default 1). Fees scale with size."New value: +"Finite, positive contracts bought on every leg (default 1). Fees scale with size."
  2. 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."
  3. First observedv1.2.1

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/closed-world, yet the description still adds substantive behavior: no network calls, the exact assessment flags (relation_verified=false, execution_verified=false, conditional_on_relation=true), and a clear statement of what it does NOT verify (resolution rules, order-book depth, full fills). This is precisely the limitation disclosure an agent needs before trusting the output.

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 purpose and alternative, then return shape, then caveats, then constraints — a sensible ordering with no filler sentences. The return-field enumeration and trailing constraint block are dense and could be tighter, but each 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?

Despite an output schema existing, the description adds the assessment-flag semantics an agent cannot get from field names alone, plus input validity rules. For a pure-calculation tool with 4 parameters and nested quote objects, nothing material is missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds validation domains the schema only partially states: quotes must be finite and in [0,1], fee-priced inputs strictly between 0 and 1, and (venue, market_id) must be unique. It does not elaborate on maker/contracts semantics beyond the schema, keeping it just short of a 5.

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?

The opening sentence states a specific verb and resource: 'Calculate a price-bound violation and basket economics conditional on the relation you supply.' It immediately distinguishes itself from the live sibling by naming check_constraint_live as the tool that fetches current quotes, so an agent can route 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?

Explicit when-to-use guidance: hypothetical or historical prices. Explicit alternative: 'use check_constraint_live to fetch current quotes instead.' It also points to list_relation_types for relation semantics, giving the agent a complete routing picture.

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