Skip to main content
Glama

rebalance_portfolio

Rebalance a multi-currency portfolio: given holdings, per-holding (or per-asset-class) target weights, cash and FX rates, return the exact BUY/SELL trades to reach the targets, the per-currency cash movements (flagging foreign-cash overdrafts), and a summary. It is the same plan the RetireCrunch Portfolio Rebalancer page makes: class goals drive holdings (locked holdings stay put, target_mode "custom" holdings keep their target_pct, the rest share the class goal pro-rata to value), with an optional buy-only mode, tolerance band and new money. The verdict says why there are trades or none (onTarget, locked, belowMinimum, …). Planning math only — no transaction costs or taxes.

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": {
      "holdings": "<holdings>"
    },
    "name": "rebalance_portfolio"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeNo"rebalance" (default): buy and sell to reach the targets. "buyOnly": never sell; spend only the cash above the cash target, spread evenly over the under-weight holdings.rebalance
fx_ratesNoValue of 1 unit of each currency in the base currency (base currency itself is 1).
holdingsYesThe portfolio holdings to rebalance.
new_moneyNoNew money to invest, in base_currency (default 0). Added to base-currency cash before the plan is made.
base_currencyNoBase currency the portfolio is valued in.USD
class_targetsNoOptional per-asset-class goal % of the whole portfolio (incl. "Cash"). Inside a class with a goal, locked holdings stay put, target_mode "custom" holdings keep their target_pct, and the rest share what is left pro-rata to current value. Classes without a goal trade to their holdings' own target_pct.
tolerance_ptsNoTolerance band in percentage points (default 0). A class within this many points of its goal is not traded. Needs class_targets.
available_cashNoCash held per currency, keyed by ISO code.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changed
    • changedInput schema / properties / class_targets / description
      Previous value: -"Optional per-asset-class goal % (incl. \"Cash\"). When given, unlocked holdings are retargeted to hit each class goal before computing trades."New value: +"Optional per-asset-class goal % of the whole portfolio (incl. \"Cash\"). Inside a class with a goal, locked holdings stay put, target_mode \"custom\" holdings keep their target_pct, and the rest share what is left pro-rata to current value. Classes without a goal trade to their holdings' own target_pct."
    • addedInput schema / properties / holdings / items / properties / multiplier
      Added value: +{
      +  "description": "Units of the underlying one quantity unit stands for (default 1): 100 for a US equity option, 0.01 for a bond quoted in % of par. Value = quantity × price × multiplier.",
      +  "exclusiveMinimum": 0,
      +  "type": "number"
      +}
    • addedInput schema / properties / holdings / items / properties / sec_type
      Added value: +{
      +  "description": "Broker security type (STK, OPT, BOND, BILL …). BOND and BILL trade in 1,000-face steps.",
      +  "type": "string"
      +}
    • addedInput schema / properties / holdings / items / properties / target_mode
      Added value: +{
      +  "default": "auto",
      +  "description": "Only matters inside a class that has a goal in class_targets. \"auto\" (default): the holding shares what is left of the class goal with the other auto holdings, pro-rata to current value, and its target_pct is ignored. \"custom\": the holding keeps its own target_pct.",
      +  "enum": [
      +    "auto",
      +    "custom"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / mode
      Added value: +{
      +  "default": "rebalance",
      +  "description": "\"rebalance\" (default): buy and sell to reach the targets. \"buyOnly\": never sell; spend only the cash above the cash target, spread evenly over the under-weight holdings.",
      +  "enum": [
      +    "rebalance",
      +    "buyOnly"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / new_money
      Added value: +{
      +  "default": 0,
      +  "description": "New money to invest, in base_currency (default 0). Added to base-currency cash before the plan is made.",
      +  "maximum": 1000000000000,
      +  "minimum": 0,
      +  "type": "number"
      +}
    • addedInput schema / properties / tolerance_pts
      Added value: +{
      +  "default": 0,
      +  "description": "Tolerance band in percentage points (default 0). A class within this many points of its goal is not traded. Needs class_targets.",
      +  "maximum": 10,
      +  "minimum": 0,
      +  "type": "number"
      +}
  2. Changed5 schema fields changed
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / available_cash / propertyNames
      Added value: +{
      +  "type": "string"
      +}
    • addedInput schema / properties / class_targets / propertyNames
      Added value: +{
      +  "type": "string"
      +}
    • addedInput schema / properties / fx_rates / propertyNames
      Added value: +{
      +  "type": "string"
      +}
    • removedInput schema / properties / holdings / items / additionalProperties
      Removed value: -false
  3. Added

TDQS

A3.6/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does reasonably well: it discloses the response shape (trades, cash movements with foreign-cash overdraft flags, summary, a verdict with enumerated reasons like onTarget/locked/belowMinimum) and bounds the computation as pure planning math with no costs or taxes. It never states outright that no trades are executed, which is the one fact an agent most needs to avoid misusing a BUY/SELL-returning tool.

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

Conciseness3/5

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

The first sentence is a clean, front-loaded statement of inputs and outputs. The second sentence is a ~60-word run-on with stacked parentheticals ("locked holdings stay put, target_mode "custom" holdings keep their target_pct, the rest share the class goal pro-rata to value") that would read far better as a short list, though no sentence is pure 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 an 8-parameter tool with nested objects, deep conditional logic (class goals vs. per-holding targets, auto vs. custom, tolerance) and no output schema, the description is nearly sufficient — it explains what comes back and the verdict semantics. The residual gap is not distinguishing itself from get_rebalance_plan, which leaves the routing question open.

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 coverage is 100%, so every parameter is already documented in the schema. The description's discussion of class goals, locked holdings, target_mode "custom", tolerance bands and new money largely restates the class_targets and target_mode schema text, adding reinforcement rather than new meaning; baseline 3 is appropriate.

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?

Specific verb+resource ("Rebalance a multi-currency portfolio") followed by inputs and the three outputs (trades, per-currency cash movements, summary). It is far more informative than a tautology, but it never distinguishes itself from the sibling get_rebalance_plan, which by name appears to produce the same artifact — the description instead compares itself to a web page ("the RetireCrunch Portfolio Rebalancer page"), which does not help an agent choosing between MCP tools.

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?

Usage is implied rather than stated: it clarifies the tool is "Planning math only — no transaction costs or taxes," and explains optional behaviors (buy-only mode, tolerance band, new money) that hint at when each applies. There is no explicit when-to-use/when-not guidance and no pointer to the sibling that likely returns the same plan, so an agent must infer routing.

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