Skip to main content
Glama

ForexDemo.com

Position Size Calculator

calculate_position_size
Read-onlyIdempotent

How many lots to trade so that hitting the stop-loss loses a set percentage or amount of the account. Same calculation as the Position Size Calculator page at https://forexdemo.com/position-size-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

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "calculate_position_size"
  }
}

Input Schema

NameRequiredDescriptionDefault
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 the account currency is not in the pair.
riskNoRisk per trade: a percentage (1 for 1%) or an amount, per riskMode.
sideNobuy (long) or sell (short).buy
stopNoStop-loss price (stopMode prices).
entryNoEntry price (stopMode prices).
priceNoOptional pair price, for the position value. Leave it out to use the example price.
spreadNoOptional spread to add to the stop distance, in costUnit (buys only, as on the page).
balanceNoAccount balance in the account currency. Needed when riskMode is percent.
lotStepNoThe smallest size step your broker allows.0.01
costUnitNoUnit of spread and slippage.pips
currencyNoThe currency the trading account is held in.USD
riskModeNopercent: risk is a percentage of the balance. money: risk is an amount in the account currency.percent
slippageNoOptional stop slippage allowance, in costUnit.
stopModeNopips: give the stop distance in stopPips. prices: give the entry and stop prices.pips
stopPipsNoStop-loss distance (stopMode pips).
stopUnitNoUnit of stopPips: pips or points (10 points = 1 pip).pips
commissionNoOptional commission per standard lot, in the account currency.
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

A3.9/5.0
Behavior4/5

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

Annotations already cover read-only, idempotent, non-destructive, and closed-world behavior, so the bar is lower. The description still adds real value by disclosing that all inputs are optional, that missing values are substituted with page defaults, and that those defaults are echoed back in the reply — information an agent cannot get from the annotations.

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?

Two sentences, both front-loaded with the core definition first and the optionality/default rule second. Nothing is redundant with the schema, and there is no filler.

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 19-parameter calculator with no output schema, the definition covers the essential calling contract — optionality and default substitution — and implies the primary result (lot size). It is slightly thin on the full shape of the reply beyond the defaults listing, but the core is adequately covered.

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. The description goes beyond the schema by establishing the cross-parameter rule that every input is optional and defaulted, which is what governs how the agent should choose among the 19 fields and the interacting stopMode/riskMode/stopUnit parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a concrete computation: how many lots to trade so that a stop-loss hit loses a set percentage or amount of the account. That is a specific verb-plus-resource framing that separates it from pip, margin, or risk-reward calculators. It stops short of naming which sibling to use for adjacent questions, so it isn't a full 5.

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 gives practical usage context by pointing to the equivalent web page and explaining that omitted inputs fall back to that page's defaults. However, it offers no when-not guidance and never routes the agent to a sibling such as calculate_risk_reward or calculate_pip when those are the better fit.

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