Skip to main content
Glama

get_trading_pnl

Read-onlyIdempotent

Calculates realized trading P&L using per-account moving-average cost basis, with by-symbol or round-trip views and custom date ranges for portfolio review.

Instructions

Realized trading P&L under per-account moving-average cost basis.

view "by_symbol": realized P&L, fees and taxes per symbol for the period. view "round_trips": closed buy-to-sell cycles, win rate and open-position P&L. start/end (ISO YYYY-MM-DD) override period. detail_level "summary" lists 20 by_symbol rows, incomplete data first, then the largest realized P&L (symbols_page has the total), or the top 10 round_trips symbols by |realized P&L| with reason groups (symbol_count, omitted_symbols); pass symbol or detail_level "full" for every symbol. Fetched broker rows are recorded in the local append-only ledger (no broker writes).

Input Schema

NameRequiredDescriptionDefault
endNo
viewNoby_symbol
startNo
periodNoYTD
symbolNo
accountNoall
detail_levelNosummary

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

Annotations already cover read-only, idempotent, non-destructive and open-world, so the marginal bar is met by the description adding real side-effect context: fetched broker rows land in a local append-only ledger with no broker writes. It also discloses result-truncation behavior (20 rows / top 10 by |realized P&L|, omitted_symbols). It does not mention cost of fetching or rate/limit behavior.

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?

It is front-loaded with the core definition and each subsequent clause conveys distinct information with almost no filler. Some clauses are dense and reference undeclared fields ('symbols_page has the total', 'reason groups (symbol_count, omitted_symbols)'), making it harder to scan than it needs to be.

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?

For a 7-parameter, zero-required tool with annotations and an output schema, the description covers mode selection, date precedence, truncation and write side effects. The remaining gap is per-parameter meaning for 'account' and 'period', which an agent must infer from the enum and default.

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 description coverage is 0%, so the description carries the burden and mostly does: view enum values, ISO format and override precedence for start/end, detail_level summary-vs-full, and symbol for drilling in. The 'account' parameter and the period enum values (MTD/YTD/ALL) are never explained beyond the default, leaving partial gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The first line states a specific resource and metric (realized trading P&L) plus the accounting method (per-account moving-average cost basis), which is more precise than the name alone. The two 'view' bullets further split the tool into its two modes. It does not name or contrast with siblings such as get_portfolio_returns or get_transactions, so it stops short of a 5.

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?

It tells the agent which view to pick and what each returns, states that start/end override period, and explains that 'summary' truncates while passing symbol or detail_level 'full' expands to every symbol. That is actionable routing within the tool. It offers no exclusions or comparison against alternative portfolio/P&L tools, so no 5.

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