Skip to main content
Glama

analyze_portfolio

Read-onlyIdempotent

Compute portfolio performance from transaction history: holdings, average cost, market value, unrealized/realized profit, dividends, returns, concentration, drawdown, and benchmark comparisons.

Instructions

Use it whenever the user tells you about shares they bought or sold, by count and date ("500 SISE in January 2023, sold them all in July 2025"), even a single purchase or a position already closed. Analyze an actual brokerage account from its transactions (buys, sells, cash dividends received, bonus issues): each holding's quantity, average cost, market value, weight, unrealized and realized profit, dividends and total result; account totals and the money-weighted annual return; concentration (largest holding, top three, by currency); best and worst holding; and the current holdings' volatility and maximum drawdown over the last year. Use it for "how is my portfolio doing", "which stock lost me the most", "what is my cost", and, with compare_with, "how did my portfolio do against BIST 100 (or gold, another share)": it then compares each holding over its own period and the whole account over its own cash flows. For "did my savings keep up with inflation" use portfolio_real_return. Only symbol, date and quantity are needed: call it with what the user gave rather than asking for prices, days or fees first (missing prices use the day's close, a month alone uses its first session, and the result flags both). Describes the past, not what to buy or sell.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
currencyNoReport currency; defaults to the first asset's currency.
compare_withNoOnly when the user asks how the holdings did against something: a symbol from search_assets (e.g. 'XU100.IS' for BIST 100, 'XU030.IS', gold). Each holding gets that symbol's move over the holding's own period.
transactionsYesThe account's transactions.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.9

TDQS

A4.8/5.0
Behavior5/5

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

Annotations cover read-only/idempotent/open-world, and the description still adds substantial behavior beyond them: missing prices fall back to the day's close, a bare month uses its first session, the result flags both substitutions, the 500-transaction cap is implied by scope, and it explicitly states it describes the past and offers no buy/sell advice. That is real disclosure the annotations cannot carry.

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?

Dense but every sentence carries information; usage is front-loaded ahead of the output inventory. It is on the long side with heavy parenthetical examples, keeping it below a crisp 5, but nothing is filler.

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 no output schema, the description compensates by enumerating the returned metrics and comparisons in detail, including the compare_with semantics (each holding measured over its own period, the account over its own cash flows). An agent has everything needed to call and interpret it.

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 100%, so the baseline is 3; the description goes further by telling the agent that only symbol, date and quantity are required and to call with whatever the user gave rather than soliciting prices, days or fees first, which is genuine invocation guidance beyond the field-level docs.

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?

Names a precise verb and resource ('analyze an actual brokerage account from its transactions') and enumerates the concrete outputs (quantity, average cost, market value, weight, realized/unrealized P&L, dividends, MWR, concentration). It explicitly distinguishes itself from the sibling portfolio_real_return for inflation questions, so an agent can route without opening either schema.

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?

It states exactly when to fire — whenever the user mentions shares bought or sold by count and date — including edge cases (a single purchase, an already-closed position), and gives several literal user phrasings ('how is my portfolio doing', 'which stock lost me the most'). It names the alternative tool for the adjacent inflation use case, which is explicit when-not guidance.

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