Skip to main content
Glama

Realized P&L (FIFO)

realized_pnl
Read-onlyIdempotent

Realized profit and loss from a pasted transactions export: sells matched first-in-first-out against earlier buys per symbol, fees on both sides taken out of the gain. Returns win rate, net, average win and loss, payoff ratio, average holding period in calendar days, totals by symbol, the worst and best closed lots, and sells with no buy in the data (reported apart, not counted as zero-cost wins). Reads E*TRADE's transaction download, the CSV this repo's fetcher writes, or any CSV with columns date, action (buy/sell), symbol, quantity, price and optionally fee. Options rows are set aside and counted. Nothing pasted is stored. Example: {"transactions_csv": "date,action,symbol,quantity,price,fee\n2025-01-06,buy,KO,100,61.20,0\n2025-09-02,sell,KO,100,69.85,0"}.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "transactions_csv": "<transactions_csv>"
    },
    "name": "realized_pnl"
  }
}

Input Schema

NameRequiredDescriptionDefault
symbolNoLimit the result to one symbol
transactions_csvYesThe transactions export as CSV text, header row included

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior5/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and closed-world, so the safety profile is covered. The description adds substantively beyond that: options rows are set aside and merely counted, sells with no matching buy are reported separately and not treated as zero-cost wins, and nothing pasted is stored. These are exactly the edge-case behaviors an agent could not infer from structured fields.

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?

The core computation is front-loaded in the first clause and the currency of the input format follows immediately, so the agent can stop reading early. The return-value enumeration is long but justified because there is no output schema. It reads as a dense run-on block with many clauses, which slightly hurts scanability.

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 must enumerate what comes back, and it does so thoroughly: win rate, net, average win/loss, payoff ratio, holding period, per-symbol totals, best/worst lots, and unmatched sells. It also covers accepted input formats, edge cases, a storage guarantee, and a worked example. Nothing material for correct invocation 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?

Schema coverage is 100%, so the baseline is 3; the description earns extra by enumerating the CSV's required columns and the optional fee field, which the schema only calls 'CSV text, header row included.' It also discloses that option rows are handled specially, which affects how the CSV parameter content is interpreted. The symbol parameter's narrowing behavior is left entirely to the schema.

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 description opens with a precise verb and resource: realized profit and loss computed by matching sells first-in-first-out against earlier buys per symbol. Scope is sharp enough that an agent knows exactly what computation it gets. It does not explicitly differentiate itself from the sibling trading_win_rate, even though win rate is listed as one of its outputs, 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 clearly states the input context that qualifies a call: an E*TRADE transaction download, the repo fetcher's CSV, or any CSV with date/action/symbol/quantity/price and optional fee. That gives an agent a concrete precondition for use. No exclusions or named alternatives are given, so it lands at clear-context-without-routing rather than a 5.

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.