Skip to main content
Glama

compute_portfolio_stats

Compute portfolio-level statistics for a weighted basket of tickers. Given a {ticker: weight} mapping, fetches each ticker's daily history over range and returns the portfolio-level (not per-ticker) volatility, sharpe, max_drawdown and total_return of the weighted basket. weights need NOT sum to 1 (normalized internally). Tickers that cannot be fetched are dropped, a note is added to warnings, and the remaining weights are renormalized. risk_free_rate is an annual rate used only by Sharpe. Returns the standard envelope; values holds range, the normalized weights used, and the stats dict. (paid: $0.0100/call)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rangeNo
weightsYes
risk_free_rateNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden. It discloses critical behaviors: weights are normalized internally, unfetchable tickers are dropped with warnings and renormalization, risk_free_rate only affects Sharpe, and the output envelope contains range, normalized weights, and stats. It also mentions the per-call cost, which is useful operational context.

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

Conciseness4/5

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

The description is moderately long but each sentence adds value: purpose, input format, normalization behavior, error handling, parameter semantics, and output structure. The pricing note is extra but acceptable. It is front-loaded with the main purpose and then details, without redundancy.

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

Completeness5/5

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

Given the tool has no output schema, the description adequately explains the return envelope: it holds the range, normalized weights, and stats dict, and the metrics were already listed earlier. It also covers edge cases (dropped tickers) and parameter effects, making it self-sufficient for an agent to invoke correctly.

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 description coverage is 0%, so the description must explain all parameters. It does so: 'weights' is described as a {ticker: weight} mapping, 'range' is used to fetch daily history (with an enum in schema but no meaning), and 'risk_free_rate' is specified as an annual rate used only by Sharpe. This fully compensates for the schema's lack of 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 the tool computes portfolio-level statistics for a weighted basket of tickers, and explicitly contrasts this with per-ticker statistics ('not per-ticker'). It lists the specific metrics (volatility, Sharpe, max drawdown, total return) and the resource (weighted basket), making it distinct from sibling tools like compute_stats.

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 provides clear context for when to use the tool: for a weighted basket of tickers rather than individual tickers. It also gives key usage details like weights not needing to sum to 1 and the role of risk_free_rate. However, it does not explicitly name alternative tools or state when not to use it, so it stops short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources