Skip to main content
Glama

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

Funding Cost

workflow.run_funding_cost
Read-only

Calculate the total funding cost (or income) for holding a perpetual futures position. Edge cases: sizeBase, entryPrice and days above zero; fundingRate a fraction per interval (0.0001 is 0.01%), either sign; intervalHours 0.25 to 24 (default 8); if funding exceeds the position notional there is no finite price shift that offsets it, which is an error. Not covered: a funding rate that changes during the hold, and price moves. Use when user asks "how much funding will I pay holding X days?" or "is funding eating my profit?". Returns: totalCost (positive = you pay, negative = you receive; in the coin for inverse), costPerDay, annualPct, totalPeriods, breakevenShift (size of the price move whose PnL equals the funding: up for a positive rate, down for a negative one, for either side).

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": {
      "side": "<side>",
      "sizeBase": "<sizeBase>",
      "entryPrice": "<entryPrice>",
      "fundingRate": "<fundingRate>",
      "days": "<days>"
    },
    "name": "workflow.run_funding_cost"
  }
}

Input Schema

NameRequiredDescriptionDefault
daysYesNumber of days to hold
sideYesTrade direction: "long" or "short"
sizeBaseYesPosition size in base asset
entryPriceYesEntry price
fundingRateYesFunding rate per funding interval as a DECIMAL FRACTION, not a percent: 0.0001 means 0.01%, so a quoted 0.0125% is 0.000125 (per 8h unless intervalHours says otherwise)
contractTypeNolinear = USDT-margined (default), inverse = coin-margined. For inverse, sizeBase is USD contracts and cost figures come out in the base coin.
intervalHoursNoHours between funding payments, which is the period fundingRate covers. Default 8 (3 payments a day); 1 on Hyperliquid, dYdX, Kraken and Backpack, 4 or 2 on some symbols of Binance, Bybit, OKX, Gate, KuCoin, MEXC, Aster and Phemex.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / fundingRate / description
      Previous value: -"Funding rate per funding interval as a fraction, e.g. 0.0001 (per 8h unless intervalHours says otherwise)"New value: +"Funding rate per funding interval as a DECIMAL FRACTION, not a percent: 0.0001 means 0.01%, so a quoted 0.0125% is 0.000125 (per 8h unless intervalHours says otherwise)"
  2. Changed2 schema fields changed
    • changedInput schema / properties / fundingRate / description
      Previous value: -"Funding rate per 8h period as fraction, e.g. 0.0001"New value: +"Funding rate per funding interval as a fraction, e.g. 0.0001 (per 8h unless intervalHours says otherwise)"
    • addedInput schema / properties / intervalHours
      Added value: +{
      +  "description": "Hours between funding payments, which is the period fundingRate covers. Default 8 (3 payments a day); 1 on Hyperliquid, dYdX, Kraken and Backpack, 4 or 2 on some symbols of Binance, Bybit, OKX, Gate, KuCoin, MEXC, Aster and Phemex.",
      +  "maximum": 24,
      +  "minimum": 0.25,
      +  "type": "number"
      +}
  3. Changed1 schema field changed
    • addedInput schema / properties / side / description
      Added value: +"Trade direction: \"long\" or \"short\""
  4. Changed1 schema field changed
    • addedInput schema / properties / contractType
      Added value: +{
      +  "description": "linear = USDT-margined (default), inverse = coin-margined. For inverse, sizeBase is USD contracts and cost figures come out in the base coin.",
      +  "enum": [
      +    "linear",
      +    "inverse"
      +  ],
      +  "type": "string"
      +}
  5. Added

TDQS

A4.1/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, openWorldHint=false, destructiveHint=false, so safety is covered structurally. The description adds genuine behavioral content beyond that: validation edge cases (sizeBase/entryPrice/days must be > 0), the sign convention for totalCost, the inverse-contract denomination, and the error condition when funding exceeds notional and no finite price shift offsets it.

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 verb and formula, then edge cases, then exclusions, then return semantics, in a logical order with no filler sentences. It is dense and somewhat repeats the schema's fundingRate fraction and intervalHours explanations, which is minor redundancy rather than waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, so the description correctly takes on return-value explanation, including sign meaning and the breakevenShift direction convention for both rate signs and both sides. With seven parameters, two enums and no output schema, this covers what an agent needs to call and interpret the tool correctly.

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%, so parameter meaning is already carried by the schema, including the fundingRate fraction convention and intervalHours venue examples. The description does add one thing the schema lacks: the strict positivity constraint on sizeBase, entryPrice and days, plus the default of 8 for intervalHours and the allowed 0.25-24 range. Baseline 3 plus a small increment.

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: "Calculate the total funding cost (or income) for holding a perpetual futures position." It scopes itself apart from sibling funding tools (arbitrage, breakeven) by framing the output as totalCost/costPerDay/annualPct/breakevenShift for a single position.

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?

Provides explicit when-to-use triggers with sample user phrasings ("how much funding will I pay holding X days?", "is funding eating my profit?") and explicitly declares what is out of scope: a funding rate that changes during the hold, and price moves. That is clear routing plus exclusions rather than implied usage.

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.