Skip to main content
Glama
mothanaprime

Portfolio Rotation MCP Server

by mothanaprime

stress_test

Analyze portfolio resilience by replaying historical crises, simulating rate/equity shocks, performing factor decomposition, and running Monte Carlo simulations to compute VaR and CVaR.

Instructions

Run comprehensive portfolio stress tests.

Includes: historical scenario replay (GFC, COVID, etc.), hypothetical rate/equity/sector shocks, Fama-French factor decomposition, and Monte Carlo simulation.

Args: portfolio_json: JSON array of holdings, e.g. '[{"ticker": "AAPL", "weight": 0.20, "sector": "Technology"}, ...]'. prices_json: JSON of price data from fetch_prices (the "prices" array). factor_data_json: Optional JSON of Fama-French factors from fetch_ff_factors. benchmark: Benchmark ticker (default "SPY"). run_scenarios: Run historical scenario replay (default True). run_shocks: Run hypothetical shocks (default True). run_factors: Run Fama-French factor decomposition (default True). run_montecarlo: Run Monte Carlo simulation (default True). n_simulations: Number of Monte Carlo simulations (default 10000).

Returns: JSON with scenario results, shock estimates, factor betas/alpha, Monte Carlo VaR/CVaR, risk flags, and overall risk level.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
portfolio_jsonYes
prices_jsonYes
factor_data_jsonNo
benchmarkNoSPY
run_scenariosNo
run_shocksNo
run_factorsNo
run_montecarloNo
n_simulationsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

No annotations provided, so the description carries full burden. It describes the computations performed but does not disclose any behavioral traits like side effects, safety, rate limits, or prerequisites beyond the parameter info. It is a compute-only tool, but the lack of explicit safety information is a gap.

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-organized with a purpose statement, bulleted list of test types, a clear 'Args' section for parameters, and a 'Returns' section. It is front-loaded and every sentence adds value without redundancy.

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?

Given 9 parameters, 2 required, and the presence of an output schema, the description is fairly complete. It explains inputs (including derivation like 'from fetch_prices') and return format. Could be improved by explicitly stating that fetch_prices must be called first, but it is implied.

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?

Schema coverage is 0%, so the description fully documents all 9 parameters. Each parameter has a clear explanation, example for portfolio_json, defaults, and types. This adds significant meaning beyond the schema, especially for required inputs.

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 runs comprehensive portfolio stress tests and lists specific test types (historical scenario replay, hypothetical shocks, Fama-French decomposition, Monte Carlo). This distinguishes it from sibling tools like analyze_risk (likely for single asset risk) and run_backtest (historical backtest).

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 implies usage for running stress tests on a portfolio but does not explicitly state when to use vs alternatives or when not to use. However, the tool's purpose is clear and the context of sibling tools makes usage context understandable.

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/mothanaprime/Rebalance-MCP'

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