Skip to main content
Glama

rebalance_plan

Read-only

Calculate what to buy or sell to return a portfolio to its target allocation, including whole-lot amounts and reasons; no orders are placed.

Instructions

Compute a rebalance list against the target allocation in strategy.md: what to BUY / SELL, how much, in whole lots, and why. Only produces the list, places no order — the human executes. No LLM call.

Use when the user asks "do I need to rebalance", "how far am I from my target allocation" or "what should I buy/sell to get back on target". Per-asset targets come from target_assets[].target_pct in strategy.md; assets without one split target_allocation_stock equally (target_source: "equal_split"). Lot sizes: A-shares 100, convertible bonds 10, off-exchange funds by amount, HK/others 1 (HK lot size is unknown — see lot_note).

Args: mode: "cash_only" | "sell_to_rebalance" | "hybrid" (default). band_pct: Drift band in percentage points, default 5.

Returns: rows (per target asset: current_pct / target_pct / drift_pct / action BUY|SELL|NONE / amount in base currency / units / reason), totals (cash_after, turnover, n_trades), unmanaged holdings, warnings; or {"status": "error", "error": ...}.

Input Schema

NameRequiredDescriptionDefault
modeNocash_only: buy underweights with cash above the target cash ratio, never sell. hybrid (default): use that cash first, sell overweights only to cover the shortfall. sell_to_rebalance: sell every overweight back to target and buy underweights with the proceeds plus spare cash.hybrid
band_pctNoDrift band in percentage points (default 5): holdings within ±band of target are left alone.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.45.1

TDQS

A4.4/5.0
Behavior5/5

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

Adds substantial behavior beyond readOnlyHint: it places no order, makes no LLM call, explains target sourcing, equal-split fallback, lot-size rules, and return/error shape. This is rich context for a read-only planning tool.

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-loads what the tool computes and the key no-order boundary, then provides useful usage and return details. It is somewhat long, and the returns section is partly redundant because an output schema exists, but overall it is structured and mostly earns its space.

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

Completeness5/5

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

Given the rich input schema, output schema, and readOnlyHint annotation, the description covers the remaining agent-relevant context: target allocation sourcing, lot-size constraints, human execution, no LLM call, and error returns. Nothing critical is missing for correct selection and invocation.

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% and both parameters already have detailed schema descriptions, including mode semantics, defaults, and band_pct range. The description repeats the mode/band basics rather than adding much 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 verb and resource: compute a rebalance list against target allocation, with explicit scope that it only produces BUY/SELL/NONE recommendations and places no orders. This clearly distinguishes it from execution-oriented siblings such as buy, sell, and record_execution.

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

Usage Guidelines4/5

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

Gives explicit user-question triggers ('do I need to rebalance', 'how far am I from target', 'what should I buy/sell'). It also clarifies the human-execution boundary, though it does not explicitly name all relevant alternatives such as what_if for scenario analysis.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.