Skip to main content
Glama
dun999

FinSight

analyze_var

Calculate Value-at-Risk and Expected Shortfall for crypto and multi-asset portfolios using real-time volatility data from CoinGecko to assess potential losses at 95% and 99% confidence levels.

Instructions

Value-at-Risk (VaR) and CVaR (Expected Shortfall) at 95% and 99% confidence. Uses real volatility auto-fetched from CoinGecko for known crypto tickers. Returns daily and annualised VaR/CVaR, worst-case dollar loss on $1M AUM, and interpretation. Payment: $0.02 USDC on Tempo chain.

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 handler function for the `analyze_var` tool, which computes Value at Risk (VaR) and Conditional Value at Risk (CVaR) for a given portfolio.
    export function analyzeVaR(portfolio: Portfolio): VaRResult {
      const { annualMean, annualVol } = portfolioStats(portfolio)
    
      // z-scores for 95% and 99% confidence (one-tailed)
      const Z_95 = 1.6449
      const Z_99 = 2.3263
    
      const confidence95 = computeBand(annualMean, annualVol, Z_95, 0.95)
      const confidence99 = computeBand(annualMean, annualVol, Z_99, 0.99)
    
      // Dollar impact on a $1,000,000 AUM position
      const worstCaseDollarLoss1M = Math.max(0, Math.round(confidence99.annualCVaR * 1_000_000))
    
      return {
        confidence95,
        confidence99,
        worstCaseDollarLoss1M,
        interpretation: buildInterpretation(confidence95, confidence99, portfolio.profile),
      }
    }
  • src/index.ts:563-570 (registration)
    Registration of the /analyze/var tool endpoint.
    app.post('/analyze/var', validate, charge('0.01'), async (c) => {
      try {
        return c.json(withMeta(c, analyzeVaR(c.get('portfolio'))))
      } catch (err) {
        console.error(err)
        return internalError(c)
      }
    })
Behavior4/5

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

No annotations provided, so description carries full burden. Discloses external data dependency (CoinGecko), specific output format (daily/annualized VaR, $1M AUM worst-case dollar loss), interpretation included, and monetary cost. Could clarify if operation is idempotent/read-only or state-changing beyond payment.

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 compact sentences with zero waste: financial definition with confidence levels first, data source mechanics second, outputs and payment third. Every clause provides distinct value (metrics, auto-fetch behavior, return structure, cost).

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?

Despite no output schema and no annotations, adequately describes what gets returned (VaR/CVaR figures, interpretation) and discloses payment mechanism. Complex nested schema with 12+ sub-properties is appropriately handled by referencing the auto-population logic rather than listing all fields.

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 coverage is 83% (high), establishing baseline 3. Description adds valuable semantic context by explicitly linking 'known crypto tickers' to CoinGecko auto-fetch behavior and clarifying that the $1M AUM serves as a reference normalization for dollar loss calculations, which bridges input parameters to implied output interpretation.

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 financial metrics (Value-at-Risk, CVaR/Expected Shortfall) with precise confidence levels (95%, 99%), distinguishes from general risk analysis siblings (analyze_risk) through specificity of calculation method, and identifies the target resource (portfolio holdings).

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?

Implies usage for crypto portfolios via CoinGecko reference and specifies the $0.02 USDC payment requirement on Tempo chain, but lacks explicit guidance on when to choose this over analyze_risk or other sibling analysis tools.

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