Skip to main content
Glama

optimize_portfolio_tool

Optimize portfolio allocation to maximize return or minimize risk. Provide assets with expected return, risk, and sector, then set objective, budget, risk tolerance, sector constraints, and solver to compute optimal weights.

Instructions

Optimize portfolio allocation to maximize return or minimize risk.

    Args:
        assets: List of asset dictionaries with expected return, risk, and sector
        objective: Optimization objective ("maximize_return", "minimize_risk", "maximize_sharpe", "risk_parity")
        budget: Total budget to allocate (default: 1.0)
        risk_tolerance: Maximum acceptable portfolio risk (optional)
        sector_constraints: Maximum allocation per sector (optional)
        min_allocation: Minimum allocation per asset (default: 0.0)
        max_allocation: Maximum allocation per asset (default: 1.0)
        solver_name: Solver to use ("CBC", "GLPK", "GUROBI", "CPLEX")
        time_limit_seconds: Maximum solving time in seconds (default: 30.0)

    Returns:
        Optimization result with optimal portfolio allocation
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assetsYes
objectiveNomaximize_return
budgetNo
risk_toleranceNo
sector_constraintsNo
min_allocationNo
max_allocationNo
solver_nameNoCBC
time_limit_secondsNo
Behavior2/5

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

Annotations are absent, so the description must carry the burden of behavioral disclosure. However, it only states that the tool performs optimization and returns a result, without mentioning permissions, side effects (e.g., data mutations), or computational constraints beyond the time limit parameter.

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 efficiently structured with an Args/Returns format, covering all parameters with defaults and brief explanations. Every sentence adds value, and there is no redundant or irrelevant text.

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 thoroughly documents the 9 input parameters but provides minimal detail on the output ('Optimization result with optimal portfolio allocation'). With no output schema, more return value specificity (e.g., fields like weights, performance metrics) would improve completeness.

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

Parameters5/5

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

Despite 0% schema description coverage, the tool's description provides detailed explanations for each parameter (e.g., 'assets: List of asset dictionaries with expected return, risk, and sector'), adding crucial meaning beyond the raw schema types. This fully compensates for the missing schema descriptions.

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 'Optimize portfolio allocation to maximize return or minimize risk,' specifying a concrete action and resource. It distinguishes itself from sibling tools (e.g., production planning, scheduling) by focusing on portfolio optimization.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. The description does not mention when-not-to-use or suggest other tools from the sibling list, leaving the agent to infer from the tool name alone.

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/dmitryanchikov/mcp-optimizer'

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