Skip to main content
Glama
Sharmarajnish

Constrained Optimization MCP Server

solve_portfolio_optimization

Find optimal asset allocations that maximize expected return while constraining portfolio risk using mean-variance optimization.

Instructions

Solve portfolio optimization problems using modern portfolio theory.

This tool implements Markowitz mean-variance optimization to find optimal
asset allocations that maximize expected return while constraining risk.

Args:
    assets: List of asset names
    expected_returns: List of expected returns for each asset
    risk_factors: List of risk factors (standard deviations) for each asset
    correlation_matrix: Correlation matrix between assets
    max_allocations: Optional maximum allocation limits for each asset
    risk_budget: Optional maximum portfolio risk (variance)
    description: Optional problem description
    
Returns:
    Optimal portfolio weights and performance metrics
    
Example:
    assets = ["Bonds", "Stocks", "RealEstate", "Commodities"]
    expected_returns = [0.08, 0.12, 0.10, 0.15]
    risk_factors = [0.02, 0.15, 0.08, 0.20]
    correlation_matrix = [[1.0, 0.2, 0.3, 0.1], [0.2, 1.0, 0.6, 0.7], ...]
    max_allocations = [0.4, 0.6, 0.3, 0.2]
    risk_budget = 0.01

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assetsYes
expected_returnsYes
risk_factorsYes
correlation_matrixYes
max_allocationsNo
risk_budgetNo
descriptionNo
Behavior3/5

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

No annotations are provided, so the description must bear the full burden. It describes the optimization goal (maximize return, constrain risk) and mentions returns, but lacks details on computational assumptions, error handling, or prerequisites (e.g., positive semidefinite correlation matrix).

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 well-structured with a clear purpose statement, followed by an Args list, Returns, and Example. Every sentence adds value; no redundant information. It is concise yet comprehensive.

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?

The description covers the tool's purpose, parameters, and returns. However, without an output schema, the return format is vague ('weights and performance metrics'). Missing details on error conditions or validation. Given complexity, it is mostly complete for basic usage.

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 description coverage is 0%, so the description compensates well by listing each parameter with its meaning (e.g., 'List of expected returns', 'Optional maximum allocation limits') and providing a concrete example. It does not specify shape constraints or validation rules, but the example illustrates usage.

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 it solves portfolio optimization problems using modern portfolio theory (Markowitz mean-variance). The verb 'solve' and resource 'portfolio optimization' are specific and distinct from sibling tools like solve_convex_optimization or solve_linear_programming.

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?

There is no explicit guidance on when to use this tool versus alternatives like solve_convex_optimization. The example implies usage for asset allocation, but no criteria for when not to use or what alternatives are available.

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/Sharmarajnish/MCP-Constrained-Optimization'

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