Skip to main content
Glama

finance_portfolio_optimize

Read-only

Portfolio optimizer (efficient frontier) — Mean-variance portfolio optimization from price or return history. series=NAME:v1,v2,...;NAME:... (2-12 assets, prices oldest first, 11-1001 points). Optional type=returns (percent, or unit=decimal), period= per year (252 daily, 52 weekly, 12 monthly), rf= risk-free %, long_only=false (closed-form Markowitz with shorting), max_weight= / min_weight= %, target= annual return %, shrinkage=0-1 covariance shrink, current=NAME:pct;... to compare. Returns max-Sharpe, minimum-variance, risk-parity, equal-weight (and target/current) portfolios with weights, expected return, volatility, Sharpe, risk contributions, diversification ratio and effective assets, the efficient frontier, rebalance trades and data-quality flags. Long-only results match SciPy SLSQP. Price: $0.004 USDC (Base, via x402).

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": {
      "series": "<series>"
    },
    "name": "finance_portfolio_optimize"
  }
}

Input Schema

NameRequiredDescriptionDefault
seriesYesSTOCKS:100,100.8,100.2,101.1,101.9,101.4,102.3,102.9,102.2,103.4,104.1,103.6,104.8;BONDS:100,100.1,100.25,100.2,100.3,100.42,100.38,100.5,100.61,100.58,100.7,100.79,100.85;GOLD:100,99.6,100.4,100.9,100.3,101.2,101.6,101,102.1,101.8,102.5,103.1,102.7

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.1/5.0
Behavior5/5

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

Beyond the readOnly/openWorld annotations, the description discloses the full output payload (weights, expected return, volatility, Sharpe, risk contributions, diversification ratio, efficient assets, frontier, rebalance trades, data-quality flags), a validation claim ('Long-only results match SciPy SLSQP'), and a cost/auth constraint ($0.004 USDC on Base via x402) that an agent must account for before invoking.

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-loaded with the core definition and then densely packed with format and output facts; almost every clause carries operational information. The telegraphic notation (e.g. 'rf= risk-free %', 'shrinkage=0-1 covariance shrink') is efficient but slightly harder to parse on a first read.

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?

For a single-parameter compute tool with no output schema, the description covers input encoding, parameter meanings, expected outputs, cost, and a numerical-accuracy guarantee, which is everything an agent needs to call it and interpret the result. The only minor gap is guidance relative to the sibling stats tool.

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%, but only for the single 'series' property; the description supplies substantial extra meaning: the NAME:v1,v2,...;NAME:... encoding, asset-count and point-count bounds, ordering ('prices oldest first'), and units for every optional parameter (period conventions, rf in %, max/min weight in %, shrinkage 0-1, target as annual return %). It loses a point because those optional parameters appear only in the description, with no schema counterpart to confirm they are accepted.

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 and resource ('Mean-variance portfolio optimization', 'efficient frontier') and enumerates the concrete outputs (max-Sharpe, minimum-variance, risk-parity, equal-weight), so the agent knows exactly what it produces. It does not, however, explicitly differentiate itself from the sibling finance_portfolio_stats, leaving that disambiguation to inference.

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 context is implied by the exhaustive input-format instructions (2-12 assets, prices oldest first, 11-1001 points) and the note that long_only=false uses closed-form Markowitz with shorting, which tells the agent when certain parameter combinations apply. There is no explicit statement of when to pick this over finance_portfolio_stats or when not to use it at all.

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