Skip to main content
Glama

Analyze My Portfolio

analyze_portfolio
Read-onlyIdempotent

Analyze the user's stock portfolio.

Returns concentration risk (low/medium/high), a diversification score (0-10), a sector breakdown (looking through known ETFs), the biggest stocks owned directly and through funds, the biggest winner and loser by dollar impact. Concentration looks at the biggest position, the biggest sector and stocks held both directly and through funds. Use this when the user asks how diversified, concentrated or risky their portfolio is. Don't use it just to list holdings (use list_portfolio).

Limits: requires sign-in. Prices can be up to 7 days old; positions without a price are labeled, never guessed. Educational information, not investment advice.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "analyze_portfolio"
  }
}

Input Schema

NameRequiredDescriptionDefault

No arguments

Output Schema

NameRequiredDescriptionDefault
summaryNoAlways empty; kept for older clients.
is_emptyYes
demo_modeNo
frameworksNo
top_holdingNo
sign_in_hintNoA sign-in or setup tip. Never a paid offer.
biggest_loserNo
biggest_winnerNo
sector_breakdownNo
concentration_riskNounknown
concentration_reasonNo
diversification_scoreNo
lookthrough_top_namesNoUp to 5 biggest single stocks counting direct shares plus what funds hold (VOO, SPY, VTI, QQQ, ARKK top holdings).
sector_breakdown_noteNo
price_unavailable_tickersNoTickers with no live price right now; P&L numbers leave them out.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • changedOutput schema / $defs / HoldingSummary / description
      Previous value: -"One-line reference to a holding by ticker + its P&L. Used to\nreference biggest_winner / biggest_loser without inlining the\nfull Position (which would drift from list_portfolio's output).\n\nBUG-41 (2026-08-24): added `pnl_dollars` alongside `pnl_pct` so\nLLM narrators can quote BOTH numbers verbatim without recomputing\n(LLM Scope Boundary). Winner/loser ranking is now by absolute\ndollar impact, not percentage — a $87 loss on a $3 position that\nstarted at $91 is a meaningful portfolio event; a +36% gain on\na $5 position is not."New value: +"A holding's ticker and gain or loss, in percent and dollars."
    • changedOutput schema / $defs / LookthroughName / description
      Previous value: -"One stock counting what funds hold (MARKET-17 S6-14).\n\ntotal_pct = direct_pct + via_funds_pct, pre-computed in Python."New value: +"One stock, counting shares owned directly plus what funds hold."
    • changedOutput schema / description
      Previous value: -"Return type for `analyze_portfolio()`. PhD-style analysis over\nthe caller's merged holdings, every field computed in Python.\n\nPost-BUG-24: `is_empty=True` with `upgrade_hint` for anon /\nempty-tenant callers. Never fake analysis."New value: +"How concentrated and diversified the user's portfolio is, computed from their holdings."
    • addedOutput schema / properties / sign_in_hint
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "A sign-in or setup tip. Never a paid offer.",
      +  "title": "Sign In Hint"
      +}
    • removedOutput schema / properties / upgrade_hint
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "string"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "title": "Upgrade Hint"
      -}
  2. Changed5 schema fields changed
    • addedOutput schema / $defs / LookthroughName
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "One stock counting what funds hold (MARKET-17 S6-14).\n\ntotal_pct = direct_pct + via_funds_pct, pre-computed in Python.",
      +  "properties": {
      +    "direct_pct": {
      +      "description": "Weight held directly, in percent of the portfolio.",
      +      "title": "Direct Pct",
      +      "type": "number"
      +    },
      +    "ticker": {
      +      "title": "Ticker",
      +      "type": "string"
      +    },
      +    "total_pct": {
      +      "description": "Direct + via funds, in percent of the portfolio.",
      +      "title": "Total Pct",
      +      "type": "number"
      +    },
      +    "via_funds_pct": {
      +      "description": "Weight held inside funds (top fund holdings), in percent.",
      +      "title": "Via Funds Pct",
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "ticker",
      +    "direct_pct",
      +    "via_funds_pct",
      +    "total_pct"
      +  ],
      +  "title": "LookthroughName",
      +  "type": "object"
      +}
    • changedOutput schema / description
      Previous value: -"Return type for `analyze_portfolio()`. LLM-narrated PhD-style\nanalysis over the caller's merged holdings.\n\nLLM Scope Boundary compliance (CLAUDE.md): every numeric field\n(diversification_score, sector_breakdown, pnl_pct) is computed\nin Python BEFORE the LLM sees it. The `summary` narrative is the\nONLY LLM-produced text — and its prompt uses `_format_named_fields`\nwith a TRUST_RULE that the LLM must reference field names\nverbatim, never recompute.\n\nPost-BUG-24: `is_empty=True` with `upgrade_hint` for anon /\nempty-tenant callers. Never fake analysis."New value: +"Return type for `analyze_portfolio()`. PhD-style analysis over\nthe caller's merged holdings, every field computed in Python.\n\nPost-BUG-24: `is_empty=True` with `upgrade_hint` for anon /\nempty-tenant callers. Never fake analysis."
    • addedOutput schema / properties / lookthrough_top_names
      Added value: +{
      +  "description": "Up to 5 biggest single stocks counting direct shares plus what funds hold (VOO, SPY, VTI, QQQ, ARKK top holdings).",
      +  "items": {
      +    "$ref": "#/$defs/LookthroughName"
      +  },
      +  "title": "Lookthrough Top Names",
      +  "type": "array"
      +}
    • addedOutput schema / properties / price_unavailable_tickers
      Added value: +{
      +  "description": "Tickers with no live price right now; P&L numbers leave them out.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "title": "Price Unavailable Tickers",
      +  "type": "array"
      +}
    • addedOutput schema / properties / summary / description
      Added value: +"Always empty; kept for older clients."
  3. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$defs": {
      +    "HoldingSummary": {
      +      "additionalProperties": false,
      +      "description": "One-line reference to a holding by ticker + its P&L. Used to\nreference biggest_winner / biggest_loser without inlining the\nfull Position (which would drift from list_portfolio's output).\n\nBUG-41 (2026-08-24): added `pnl_dollars` alongside `pnl_pct` so\nLLM narrators can quote BOTH numbers verbatim without recomputing\n(LLM Scope Boundary). Winner/loser ranking is now by absolute\ndollar impact, not percentage — a $87 loss on a $3 position that\nstarted at $91 is a meaningful portfolio event; a +36% gain on\na $5 position is not.",
      +      "properties": {
      +        "pnl_dollars": {
      +          "title": "Pnl Dollars",
      +          "type": "number"
      +        },
      +        "pnl_pct": {
      +          "title": "Pnl Pct",
      +          "type": "number"
      +        },
      +        "ticker": {
      +          "title": "Ticker",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "ticker",
      +        "pnl_pct",
      +        "pnl_dollars"
      +      ],
      +      "title": "HoldingSummary",
      +      "type": "object"
      +    }
      +  },
      +  "additionalProperties": false,
      +  "description": "Return type for `analyze_portfolio()`. LLM-narrated PhD-style\nanalysis over the caller's merged holdings.\n\nLLM Scope Boundary compliance (CLAUDE.md): every numeric field\n(diversification_score, sector_breakdown, pnl_pct) is computed\nin Python BEFORE the LLM sees it. The `summary` narrative is the\nONLY LLM-produced text — and its prompt uses `_format_named_fields`\nwith a TRUST_RULE that the LLM must reference field names\nverbatim, never recompute.\n\nPost-BUG-24: `is_empty=True` with `upgrade_hint` for anon /\nempty-tenant callers. Never fake analysis.",
      +  "properties": {
      +    "biggest_loser": {
      +      "anyOf": [
      +        {
      +          "$ref": "#/$defs/HoldingSummary"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null
      +    },
      +    "biggest_winner": {
      +      "anyOf": [
      +        {
      +          "$ref": "#/$defs/HoldingSummary"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null
      +    },
      +    "concentration_reason": {
      +      "default": "",
      +      "title": "Concentration Reason",
      +      "type": "string"
      +    },
      +    "concentration_risk": {
      +      "default": "unknown",
      +      "enum": [
      +        "low",
      +        "medium",
      +        "high",
      +        "unknown"
      +      ],
      +      "title": "Concentration Risk",
      +      "type": "string"
      +    },
      +    "demo_mode": {
      +      "default": false,
      +      "title": "Demo Mode",
      +      "type": "boolean"
      +    },
      +    "diversification_score": {
      +      "default": 0,
      +      "title": "Diversification Score",
      +      "type": "number"
      +    },
      +    "frameworks": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "title": "Frameworks",
      +      "type": "array"
      +    },
      +    "is_empty": {
      +      "title": "Is Empty",
      +      "type": "boolean"
      +    },
      +    "sector_breakdown": {
      +      "additionalProperties": {
      +        "type": "number"
      +      },
      +      "title": "Sector Breakdown",
      +      "type": "object"
      +    },
      +    "sector_breakdown_note": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "title": "Sector Breakdown Note"
      +    },
      +    "summary": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "title": "Summary"
      +    },
      +    "top_holding": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "title": "Top Holding"
      +    },
      +    "upgrade_hint": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "title": "Upgrade Hint"
      +    }
      +  },
      +  "required": [
      +    "is_empty"
      +  ],
      +  "title": "PortfolioAnalysis",
      +  "type": "object"
      +}
  4. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, closed-world and non-destructive, so the safety profile is covered. The description still adds real value beyond them: sign-in requirement, prices up to 7 days old, unpriced positions labeled rather than guessed, and the educational-not-advice disclaimer. It loses a point because much of the body re-enumerates return fields that the output schema already carries.

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?

Purpose and usage lead the description, with limits and disclaimers trailing, which is the right order. However, the middle paragraph listing every computed output largely duplicates the output schema and is the least load-bearing part of the text.

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?

With zero parameters, an output schema present, and annotations covering safety, the remaining gaps an agent could face are auth and data staleness, both of which are stated. Nothing needed to invoke it correctly is missing.

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?

The tool takes zero parameters, so there is nothing for the description to disambiguate and the baseline of 4 applies. No spurious or conflicting input guidance is introduced.

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?

Specific verb plus resource ("Analyze the user's stock portfolio") followed by the concrete outputs it produces: concentration risk, diversification score, sector breakdown, top direct and indirect holdings, biggest winner/loser. An agent can distinguish it from list_portfolio purely from the text.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit trigger ("Use this when the user asks how diversified, concentrated or risky their portfolio is") and an explicit exclusion with the correct alternative ("Don't use it just to list holdings (use list_portfolio)"). Both the when and the when-not are stated.

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