Skip to main content
Glama

TradingCalc MCP: Options, Forex, Risk Stats, Prediction Markets, On-Chain & Crypto Futures

Orderbook Impact

workflow.run_orderbook_impact
Read-only

Order-book "walk the book" impact/capacity: given order-book levels (price, size in base-asset units) and EITHER a target notional or an impact budget in bps, computes VWAP and price impact for that size, or (via bisection) the largest notional that stays inside the impact budget. Use when user asks "what's my price impact if I trade $X" or "how much can I trade before impact exceeds Y bps". side="buy" walks the asks, side="sell" walks the bids; impact is measured from the book's own mid ((best_bid+best_ask)/2) and is always a positive "cost in bps" number regardless of side. Returns: mid_price, spread_bps, vwap, impact_bps - both null when EITHER the loaded book doesn't cover the requested notional (book_sufficient=false flags this specific case) OR the notional involved is ~0 (book_sufficient stays true then; happens for a near-zero notional_usd, or in capacity mode when even an infinitesimal trade already exceeds impact_budget_bps, in which case max_notional itself resolves to 0) - and in capacity mode, max_notional plus capacity_is_lower_bound (true if the ENTIRE supplied book was consumed within budget, meaning true market capacity may exceed what was supplied - this tool only sees the levels given to it).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
asksYesAsk levels as [price, size_base] pairs, any order
bidsYesBid levels as [price, size_base] pairs, any order
sideYes"buy" walks the asks, "sell" walks the bids
notional_usdNoTarget notional to walk the book for. Provide this OR impact_budget_bps, not both.
impact_budget_bpsNoMax acceptable impact in bps; solves for the largest notional within it. Provide this OR notional_usd, not both.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

Far exceeds what the annotations provide. Documents side semantics (buy walks asks, sell walks bids), that impact is always a positive cost number from the book's own mid, the edge cases where vwap/impact are null (book insufficient vs ~0 notional), and the capacity_is_lower_bound caveat when the whole supplied book is consumed.

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-loads the core purpose in the first clause and then qualifies behavior. Some sentences are dense and the return-value enumeration is long, but every statement earns its place and no filler is present.

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 no output schema, the description carries the return-value contract fully, including the null conditions, book_sufficient flag, and capacity_is_lower_bound semantics. An agent has everything needed to call and interpret this tool.

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 meaningfully enriches it: it explains side semantics, the either/or relationship between notional_usd and impact_budget_bps, and the return fields correlated with each parameter mode. It stops short of describing the [price, size_base] level format, which the schema handles.

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 ('walk the book' impact/capacity) and precisely describes the two computational modes. The description would let an agent distinguish it from siblings like run_swap_price_impact without opening the schema.

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?

Gives explicit trigger phrases ('what's my price impact if I trade $X', 'how much can I trade before impact exceeds Y bps') that map cleanly to the two modes. No explicit when-not or named alternative, but the usage context is very clear.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.