Skip to main content
Glama

ForexDemo.com

Forex Profit Calculator

calculate_profit
Read-onlyIdempotent

Profit or loss of one Forex or gold trade from its open and close prices, in pips and in the account currency, before and after spread, commission and swap. Same calculation as the Forex Profit Calculator page at https://forexdemo.com/forex-profit-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": {
      "open": "<open>",
      "close": "<close>"
    },
    "name": "calculate_profit"
  }
}

Input Schema

NameRequiredDescriptionDefault
openYesOpen price.
pairNoCurrency pair or gold (XAU/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.
stopNoOptional stop-loss price.
swapNoOptional overnight swap for all nights held, in the account currency. A charge has a minus sign, such as -12.50.
closeYesClose price, or the price you expect.
spreadNoOptional spread, in spreadUnit.
targetNoOptional take-profit price.
balanceNoOptional account balance, to show the result as a percentage.
currencyNoThe currency the trading account is held in.USD
sizeUnitNoHow the size is given: standard (100,000 units), mini (10,000), micro (1,000), nano (100) lots, or units.standard
commissionNoOptional commission per standard lot, in the account currency.
spreadUnitNoUnit of spread: pips, or points as MetaTrader shows it.pips
commissionBasisNoside: charged when opening and again when closing. round: once per round trip.side

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already cover the read-only, idempotent, non-destructive profile, so the bar is lower, and the description still adds real behavior: omitted inputs fall back to the page's defaults and those defaults are echoed back in the reply, plus the result is broken out into pips vs account currency and pre- vs post-cost figures. It stops short of stating the response shape or how the rate requirement is signaled as an error.

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?

Three tight sentences with the core purpose front-loaded and the defaults rule last where it belongs. The external page URL is arguably the least essential element, though it does anchor the calculation's definition.

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?

For a 16-parameter, 2-required calculation with no output schema, the description adequately conveys what comes back (pips, account currency, before/after costs) and how omitted inputs behave. It could say more about the conditional requirement on 'rate' or the unit interplay, but those are covered in the schema itself.

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 description coverage is 100%, so the baseline is 3, but the description adds a global parameter rule not encoded in the schema: every input is optional unless marked required, and unset inputs use documented defaults returned in the reply. That meaningfully changes how an agent fills the 16-parameter object rather than restating field descriptions.

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 description opens with a specific verb and resource: computing profit or loss of ONE Forex or gold trade from open and close prices, reported in pips and account currency, before and after spread, commission and swap. That scope (a single round-trip trade with all cost components) clearly separates it from narrower siblings like calculate_pip or calculate_swap without needing to name them.

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?

It states the calculation it mirrors and the defaults rule, from which usage is inferable, but gives no explicit when-to-use/when-not-to-use guidance and never points to alternatives (e.g., a swap-only or pip-value tool) for sub-calculations. An agent knows what the tool does but must reason on its own about when this is the right choice.

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