Skip to main content
Glama
dun999

FinSight

analyze_risk

Assess crypto portfolio risk using live market data. Calculates Sharpe ratio, risk tier, and per-asset scores based on holdings and weights.

Instructions

Crypto portfolio risk profiling using live CoinGecko market data. For known tickers (BTC, ETH, SOL, AVAX, ARB, etc.) you only need { asset, weight } — volatility, returns, and drawdown are auto-fetched from 365-day real price history. Returns Sharpe ratio, Sortino ratio, Calmar ratio, market beta, risk tier (low/moderate/high/very high), and per-asset risk scores. Payment: $0.01 USDC on Tempo chain (~500ms).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
holdingsYes
profileNoRisk profile — affects rebalance targets and scoring. Default: balanced.
benchmarkReturnNoAnnual benchmark return for Sharpe calculation, e.g. 0.08 = 8%. Default: 0.08.
riskFreeRateNoAnnual risk-free rate for Sortino and VaR excess return, e.g. 0.05 = 5%. Default: 0.05.
rebalanceMethodNoPortfolio construction method for rebalance recommendations. Default: profile.
marketIndicatorsNoOptional macro indicators — improves market regime detection confidence to HIGH when 3+ provided.

Implementation Reference

  • The main implementation of analyzeRisk which calculates risk metrics for a portfolio including volatility, sharpe ratio, sortino ratio, and beta.
    export function analyzeRisk(
      portfolio: Portfolio,
      returnSeries?: Record<string, number[]>,
    ): RiskResult {
      const portVol = portfolioVolatility(portfolio.holdings, returnSeries)
    
      const assets: AssetRisk[] = portfolio.holdings.map((h) => {
        const effectiveBeta = resolveEffectiveBeta(h, returnSeries)
    
        return {
          asset: h.asset,
          assetClass: h.assetClass,
          riskScore: Number(assetRiskScore(h.volatility, h.maxDrawdown, h.isStable).toFixed(1)),
          sharpe: sharpeRatio(h.avgReturn, portfolio.benchmarkReturn, h.volatility),
          sortino: sortinoRatio(h.avgReturn, portfolio.riskFreeRate, h.volatility),
          beta: Number(effectiveBeta.toFixed(4)),
        }
      })
    
      const portfolioRisk = portfolio.holdings.reduce(
        (acc, h, i) => acc + h.weight * assets[i].riskScore,
        0,
      )
    
      const weightedReturn = portfolio.holdings.reduce((acc, h) => acc + h.weight * h.avgReturn, 0)
      const weightedMaxDD = portfolio.holdings.reduce((acc, h) => acc + h.weight * h.maxDrawdown, 0)
      const portfolioBeta = assets.reduce((acc, a, i) => acc + portfolio.holdings[i].weight * a.beta, 0)
    
      return {
        portfolioRisk: Number(portfolioRisk.toFixed(1)),
        portfolioVolatility: Number(portVol.toFixed(4)),
        portfolioSharpe: sharpeRatio(weightedReturn, portfolio.benchmarkReturn, portVol),
        portfolioSortino: sortinoRatio(weightedReturn, portfolio.riskFreeRate, portVol),
        portfolioCalmar: calmarRatio(weightedReturn, weightedMaxDD),
        portfolioBeta: Number(portfolioBeta.toFixed(4)),
        riskTier: riskTier(portfolioRisk),
        assets,
      }
    }
Behavior4/5

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

With no annotations provided, description carries full disclosure burden effectively. Reveals critical invocation traits: external data dependency (CoinGecko live data), cost ($0.01 USDC), latency (~500ms), auto-fetch logic (365-day history), and specific return values. Missing only error-handling or cache behavior details.

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?

Three sentences pack essential information with zero waste: purpose/data source, parameter optimization guidance, and return values/cost. Front-loaded with the core function; payment info appropriately placed at end as operational constraint.

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?

Compensates adequately for missing output schema by enumerating specific return metrics (ratios, tiers, scores). Covers payment mechanism critical for agent invocation decision. Given complex nested schema (12+ sub-parameters), could briefly mention weight validation or error behavior, but sufficiently complete for selection.

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?

With 83% schema coverage (high baseline 3), description adds practical value by clarifying the relationship between 'known' tickers and optional fields, and providing concrete ticker examples (BTC, ETH, SOL, etc.) that illuminate the auto-population feature beyond the schema's technical 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?

States specific action ('risk profiling') with clear resource ('crypto portfolio') and data source ('CoinGecko'). Distinguishes from siblings like analyze_correlation or analyze_var by explicitly listing distinctive outputs (Sharpe ratio, Sortino ratio, Calmar ratio, market beta, risk tier).

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?

Provides clear guidance on when to use minimal parameters ('For known tickers... you only need { asset, weight }') vs. when manual data entry is required, effectively distinguishing input patterns. Does not explicitly name sibling alternatives, but context is sufficient for selection.

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/dun999/finsight-mpp'

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