Skip to main content
Glama

ForexDemo.com

Forex Swap Calculator

calculate_swap
Read-onlyIdempotent

Overnight swap (rollover) cost or credit of holding a Forex position, night by night including the triple day, from the swap rates a platform shows. Same calculation as the Forex Swap Calculator page at https://forexdemo.com/forex-swap-calculator.html. Every input is optional unless marked required; left-out inputs use the page's defaults, which are listed in the reply.

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": {
      "long": "<long>",
      "short": "<short>"
    },
    "name": "calculate_swap"
  }
}

Input Schema

NameRequiredDescriptionDefault
longYesSwap long (for buys), exactly as the platform shows it, in swapUnit. A charge has a minus sign, such as -9.17.
pairNoCurrency pair, such as EUR/USD. EURUSD and eur-usd are accepted too.EUR/USD
rateNoOnly needed when the account currency is not in the pair: the price of the market pair that converts it (for example the GBP/USD price for EUR/GBP in a USD account). Required when neither currency of the pair is the account currency.
sideNobuy (long) or sell (short).buy
sizeNoTrade size, counted in sizeUnit.
priceNoPair price. Needed for percent swaps, base-currency money swaps, and when the account currency is the pair's first currency.
shortYesSwap short (for sells), exactly as the platform shows it, in swapUnit.
nightsNoNights the trade is held.
balanceNoOptional account balance, for effective leverage.
openDayNoDay the trade is opened.Monday
currencyNoThe currency the trading account is held in.USD
sizeUnitNolots (100,000 units each) or units.lots
swapUnitNoThe unit the platform shows the swap in: points (MetaTrader), pips, percent a year, or money per standard lot per night.points
precisionNoOnly for points: fractional when prices have 5 decimals (3 for yen pairs), whole when they have 4 (2 for yen pairs).fractional
tripleDayNoThe night that counts three days of interest. Usually Wednesday (Thursday for USD/CAD at some brokers).Wednesday
yearBasisNoOnly for percent: the number of days in the broker's interest year.365
amountCurrencyNoOnly for money: the currency the swap amounts are in.quote

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare read-only, idempotent, non-destructive, closed-world behavior. The description adds useful behavioral context: omitted inputs use page defaults, and those defaults are listed in the reply, though it does not describe full output format or rate-limit behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three tight sentences, front-loaded with the calculation, then the external reference, then default-input behavior. Every sentence contributes useful information and there is no filler.

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

Completeness3/5

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

For a 17-parameter calculator with no output schema, the description adequately covers the input default behavior and external reference. It does not explain what the return value contains beyond mentioning that defaults are listed, leaving the result structure (per-night vs. total, units) less clear than it could be.

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 all 17 parameters, enums, and defaults are already documented in the input schema. The description only reiterates that inputs are optional unless required and fall back to page defaults, adding minimal parameter-specific meaning beyond the schema.

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 calculation: overnight swap/rollover cost or credit for a Forex position, including triple-day interest, based on platform swap rates. This clearly distinguishes it from generic profit, pip, or margin calculators without needing to name siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implies usage by describing the swap calculation and referencing the corresponding demo page, but gives no explicit when-to-use or when-not-to-use guidance versus alternatives like calculate_profit or calculate_pip. The agent must infer the appropriate context.

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.

Resources