Skip to main content
Glama

Optimize Portfolio Weights

warden.optimize_portfolio
Read-onlyIdempotent

Computes volatility-targeted, HRP, or shrinkage mean-variance portfolio weights under concentration and turnover caps, sweeping residual capital to a defensive cash proxy without routing trades.

Instructions

Computes volatility-targeted dual-momentum, hierarchical risk parity, or shrinkage mean-variance portfolio weights under the house concentration and turnover caps. Residual capital is swept to the defensive cash proxy; never places or routes trades. Pro tool.

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": {
      "candidates": "<candidates>"
    },
    "name": "warden.optimize_portfolio"
  }
}

Input Schema

NameRequiredDescriptionDefault
top_kNoMaximum number of active risk slots to select.
methodNoAllocation method: vol_target_momentum | hrp | mvo_shrinkage.vol_target_momentum
candidatesYesCandidate risk assets: [{symbol, momentum_score, realized_vol_annual, above_trend_sma?, chandelier_triggered?, current_weight?}].
turnover_capNoMaximum one-way portfolio turnover fraction per rebalance.
floor_overridesNoOptional per-fund overrides {max_position_pct, max_gross_exposure_pct}.
cash_proxy_symbolNoDefensive cash proxy ticker receiving unallocated weight.SGOV
target_volatilityNoTarget annualized portfolio volatility (e.g. 0.12 for 12%).
cash_momentum_scoreNoComposite momentum score of the defensive cash proxy.

Output Schema

NameRequiredDescriptionDefault
howNo
toolNo
errorNo
accessNo
methodNo
safetyNo
verdictNo
provenanceNo
filtered_outNo
house_floorsNo
target_weightsNo
cash_proxy_symbolNo
cash_sweep_weightNo
request_access_atNo
overrides_deviationNo
selected_risk_assetsNo
gross_risk_exposure_pctNo
estimated_turnover_one_wayNo
estimated_portfolio_vol_annualNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.2.1
    • removedOutput schema / properties / overrides_deviation / additionalProperties
      Removed value: -true
    • addedOutput schema / properties / overrides_deviation / anyOf
      Added value: +[
      +  {
      +    "additionalProperties": true,
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedOutput schema / properties / overrides_deviation / type
      Removed value: -"object"
  2. Addedv0.6.2

TDQS

A3.5/5.0
Behavior3/5

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

The annotations already declare readOnly, idempotent, non-destructive, closed-world behavior, so the safety profile is covered. The description adds genuine context beyond that: residual capital is swept to the defensive cash proxy, house concentration and turnover caps are enforced, and 'Pro tool' signals a tier/access restriction. It stops short of describing failure modes or whether the caps can produce a partially-invested result.

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?

Two dense sentences, with the core purpose and method list front-loaded and the safety boundary immediately after. The trailing fragment 'Pro tool.' is terse to the point of being cryptic, but it is short and does convey a gating condition rather than being 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, all optional arguments are fully described in the schema and a return schema exists, so the description only needs to carry behavior — which it largely does via the caps, cash sweep, and no-trade guarantee. Remaining gaps are edge-case behavior under binding caps or malformed candidates, which are minor but real for a computational tool.

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 description coverage is 100%, so every parameter including method enum values, target_volatility, turnover_cap, and cash_proxy_symbol is already documented in the schema. The description corroborates the method choices and the existence of concentration/turnover caps but adds no syntax or semantics beyond what the schema states, which is the expected baseline.

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?

States a specific verb ('Computes') and resource ('portfolio weights') and enumerates the three allocation methods, so an agent knows exactly what the tool produces. It also implicitly separates itself from order-routing siblings by declaring 'never places or routes trades', though it never names a sibling to contrast with.

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 — you call it when you need target weights given candidates and a method — and the 'never places trades' clause marks a boundary against execution tools. There is no explicit when-not guidance, no mention of prerequisite steps (e.g. plan_rebalance, explain_sizing), and no statement about what to do if caps make the request infeasible.

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