Skip to main content
Glama
lodetomasi

Portfolio Copilot

by lodetomasi

rebalance_portfolio

Generates buy and sell proposals to rebalance a portfolio toward target weights, deploying new cash to underweight assets first and selling only as a last resort while accounting for fees.

Instructions

Cash-flow-first rebalancer. New cash buys the most underweight buckets first (BUY orders only, via allocate_cash) -- CLAUDE.md's preferred order: use new cash, suspend buys on overweights, buy underweights, and sell only as a last resort. Set allow_sells=True to also see SELL orders for buckets still beyond the rebalance band after cash is deployed, listed separately under "sell_proposals"; the BUY-only orders key is unchanged either way. Nothing here executes a trade.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetsYesbucket/symbol -> target weight as a fraction of 1.0; values must sum to 1.0
cash_eurNo
allow_sellsNoLast resort per CLAUDE.md's rebalancing order: only when True are SELL orders for buckets past target+band also proposed, under 'sell_proposals'. BUY orders (from cash) are produced either way and are never affected by this.
fixed_fee_eurNo
max_fee_ratioNo
current_valuesYesbucket/symbol -> current absolute value in EUR
variable_fee_pctNo
rebalance_band_absNo
Behavior4/5

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

With no annotations, the description carries the behavioral burden and largely meets it: it discloses that BUY orders are generated via allocate_cash, SELL orders appear only under sell_proposals when allow_sells=True, the BUY-order key is unaffected by allow_sells, and nothing executes a trade. It does not explicitly state whether any state is persisted or whether the function is otherwise side-effect free, but the main behavioral risk is addressed.

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?

The three-sentence description is front-loaded with the most important concept and each sentence carries distinct value: algorithm, policy order, and output behavior. It is dense but still readable, with 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 complex 8-parameter tool with no output schema and no annotations, the description covers the high-level algorithm, sell behavior, and non-execution, but it does not explain the full return shape, fee calculations, or parameter units. An agent can get a good idea of what the tool does but not every fact needed for confident 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?

The description adds meaning for allow_sells and the cash/band logic, but schema coverage is only 38% and fee parameters (fixed_fee_eur, variable_fee_pct, max_fee_ratio) and rebalance_band_abs are left mostly to inference from their names. It partially compensates for the low schema coverage but not enough to fully explain all 8 parameters.

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-plus-resource framing ('Cash-flow-first rebalancer') and explains the exact behavior: new cash buys underweight buckets first, with optional sell proposals. This clearly separates it from nearby siblings like allocate_cash or generate_order_plan and states that no trade is executed.

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?

It gives concrete invocation guidance: use cash first, suspend overweight buys, buy underweights, and only sell as a last resort; it also states when allow_sells=True is needed. It does not explicitly list when to choose an alternative tool, but the CLAUDE.md ordering and allow_sells condition provide clear context.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lodetomasi/portfolio-copilot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server