Skip to main content
Glama

trading_fee

Read-onlyIdempotent

Calculate the venue fee for a single fill at a given price and contract size on Kalshi or Polymarket, including maker/taker schedules, without network calls.

Instructions

Compute the venue fee for one fill at a given price and size; a pure calculation with no network calls.

Kalshi charges round_up(0.07 x M x C x P x (1 - P)) on taker fills, and
0.0175 x M x C x P x (1 - P) on maker fills where the series has maker fees;
Polymarket charges takers rate x C x p x (1 - p) and makers nothing. Use it
to price a single leg or a hypothetical fill; take a live market's fee terms
from get_quote, and use check_constraint to price a whole basket. Returns
fee, fee_per_contract, order_type and the schedule used.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
makerNoPrice a resting maker order instead of a taker order (default false).
priceYesFill price in dollars per contract, strictly between 0 and 1.
venueYesVenue: 'kalshi' or 'polymarket'.
contractsYesContracts in the fill; must be positive.
polymarket_rateNoPolymarket taker fee rate for the market, from get_quote. Defaults to 0.07, the highest documented rate. Ignored for Kalshi.
kalshi_maker_feesNoWhether the Kalshi series charges maker fees, from get_quote (default false). Ignored for Polymarket.
kalshi_multiplierNoKalshi series fee multiplier M, from get_quote's fee_schedule (default 1). Ignored for Polymarket.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changedv1.2.2
    • addedInput schema / properties / contracts / description
      Added value: +"Contracts in the fill; must be positive."
    • addedInput schema / properties / kalshi_maker_fees / description
      Added value: +"Whether the Kalshi series charges maker fees, from get_quote (default false). Ignored for Polymarket."
    • addedInput schema / properties / kalshi_multiplier / description
      Added value: +"Kalshi series fee multiplier M, from get_quote's fee_schedule (default 1). Ignored for Polymarket."
    • addedInput schema / properties / maker / description
      Added value: +"Price a resting maker order instead of a taker order (default false)."
    • addedInput schema / properties / polymarket_rate / description
      Added value: +"Polymarket taker fee rate for the market, from get_quote. Defaults to 0.07, the highest documented rate. Ignored for Kalshi."
    • addedInput schema / properties / price / description
      Added value: +"Fill price in dollars per contract, strictly between 0 and 1."
    • addedInput schema / properties / venue / description
      Added value: +"Venue: 'kalshi' or 'polymarket'."
  2. 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 readOnlyHint, idempotentHint and openWorldHint=false, but the description adds substantive behavior beyond them: the actual fee formulas per venue, the round_up rounding on Kalshi taker fills, that maker fills are free on Polymarket, and the default rate of 0.07. These are the details that determine what output an agent gets, which annotations cannot convey.

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?

Purpose is front-loaded in the first clause, followed by formulas and then routing guidance in a logical order. The two-venue formula sentence is dense but earns its length by making the calculation unambiguous; nothing is pure 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?

For a deterministic 7-parameter calculation tool, the description supplies purpose, formulas, input provenance and sibling routing, and an output schema exists so return values need not be enumerated (though fee, fee_per_contract, order_type and schedule are listed anyway). Nothing needed 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.

Parameters4/5

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

Schema coverage is 100%, so the baseline would be 3, but the description adds cross-tool provenance for the non-obvious parameters (polymarket_rate, kalshi_maker_fees, kalshi_multiplier all come from get_quote's fee terms) and maps the formula symbols M/C/P onto the inputs. It stops short of explaining edge behavior for the new anyOf rate parameter beyond the documented default.

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 clause names a specific verb and resource ('Compute the venue fee for one fill') and immediately scopes it as a pure calculation with no network calls. It also distinguishes itself from siblings by naming check_constraint as the basket-level alternative, so an agent can route correctly without reading 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?

It states exactly when to use it ('price a single leg or a hypothetical fill') and where to obtain its inputs ('take a live market's fee terms from get_quote'). The explicit handoff to check_constraint for whole-basket pricing covers the alternative path rather than leaving it to inference.

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