Skip to main content
Glama

risk_parity

Calculate portfolio weights using Inverse Volatility to balance risk across assets for diversified investment strategies.

Instructions

Calculates weights based on Inverse Volatility (Naive Risk Parity).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickersYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The risk_parity tool handler: computes portfolio weights using inverse volatility (risk parity) from 1y historical data via yfinance.
    def risk_parity(tickers: List[str]) -> str:
        """
        Calculates weights based on Inverse Volatility (Naive Risk Parity).
        """
        data = yf.download(tickers, period="1y", progress=False)['Close']
        returns = data.pct_change().dropna()
        volatility = returns.std()
        
        inv_vol = 1 / volatility
        weights = inv_vol / inv_vol.sum()
        
        w_dict = weights.to_dict()
        w_dict = {k: float(f"{v:.4f}") for k, v in w_dict.items()}
        
        return f"Risk Parity Weights: {w_dict}"
  • server.py:395-398 (registration)
    MCP registration of the risk_parity tool (imported from tools.portfolio_optimizer) into the 'Portfolio Optimization' category.
    register_tools(
        [mean_variance_optimize, risk_parity],
        "Portfolio Optimization"
    )
  • server.py:17-17 (registration)
    Import statement for risk_parity function used in MCP tool registration.
    from tools.portfolio_optimizer import mean_variance_optimize, risk_parity
Behavior1/5

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

No annotations are provided, so the description must fully disclose behavioral traits. It only states what the tool does without any information on performance characteristics, computational requirements, data sources, or error handling. For a financial calculation tool, this is a significant gap, as it doesn't address reliability, limitations, or potential side effects.

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 a single, efficient sentence that directly states the tool's purpose without any fluff. It's front-loaded with the key action and method, making it easy to parse. Every word contributes to understanding the tool's function, adhering to the principle of conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of financial calculations and the lack of annotations, the description is incomplete. It doesn't explain the output (though an output schema exists, which mitigates this), data requirements, or error conditions. For a tool with no behavioral transparency and minimal parameter guidance, it fails to provide sufficient context for reliable use.

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?

The input schema has 1 parameter with 0% description coverage, so the description must compensate. It implies that 'tickers' are used for the calculation but doesn't explain their role, required format, or constraints. Since there's only one parameter, the baseline is 4, but the description adds minimal semantic value beyond what's inferred from the tool name, so it scores slightly lower.

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?

The description clearly states the verb 'calculates' and the resource 'weights', specifying the method as 'Inverse Volatility (Naive Risk Parity)'. This distinguishes it from sibling tools like 'mean_variance_optimize' or 'portfolio_risk' by focusing on a specific risk-based weighting approach. However, it doesn't explicitly mention what the weights are for (e.g., portfolio allocation), leaving some ambiguity.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, such as needing historical data or specific market conditions, nor does it compare to sibling tools like 'mean_variance_optimize' for different optimization methods. This lack of context makes it hard for an agent to decide when this tool is appropriate.

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/N-lia/MonteWalk'

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