Skip to main content
Glama

portfolio_optimize

Read-onlyIdempotent

Optimize portfolio weights for maximum Sharpe, minimum volatility, or risk parity. Input expected returns and covariance matrix to get optimal allocation and performance metrics.

Instructions

Portfolio optimization: max Sharpe, min vol, or risk parity weights.

Use when optimizing portfolio weights for max Sharpe, min volatility, or risk parity. Provide expected returns and a covariance matrix. Returns: optimal weights, expected return, volatility, Sharpe ratio, and efficient frontier points.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNoOptimization objectivemax_sharpe
returnsYesNamed return series per asset, e.g. {"AAPL": [...], "MSFT": [...]}
risk_free_rateNoAnnual risk-free rate
Behavior4/5

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

Annotations indicate read-only, idempotent, non-destructive behavior, which the description does not contradict. The description adds behavioral context by listing the output fields (optimal weights, expected return, volatility, Sharpe ratio, efficient frontier points), which is useful beyond annotations.

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

Conciseness5/5

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

The description is only two sentences, front-loaded with the main purpose, and no redundant information. Every sentence adds value.

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?

The description explains the return values adequately given no output schema, but the missing covariance matrix input and lack of detail on the mode parameter limits completeness. Sibling tools exist that are similar, but the description does not differentiate enough.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although schema coverage is 100%, the description mentions a 'covariance matrix' input that is not present in the schema, causing inconsistency. This misleads the agent about required inputs. The description adds no meaningful extra meaning beyond the schema and introduces inaccuracy.

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 clearly states the tool returns optimal weights for three specific objectives: max Sharpe, min volatility, or risk parity. This distinguishes it from sibling tools like portfolio_risk-parity-weights and provides a specific verb and resource.

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?

The description explicitly states when to use the tool ('when optimizing portfolio weights') and what inputs are required (expected returns and a covariance matrix). However, it does not mention when not to use or provide alternatives, leaving some ambiguity.

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/QuantOracledev/quantoracle'

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