Skip to main content
Glama

Portfolio Terminal

Tax-loss harvesting before December 31

tax_loss_harvest
Read-onlyIdempotent

Computes, on the lots the user gives (ticker, shares, price, date, account and its type), the losses a sale before December 31 would realize and what they offset, with the engine of Portfolio Terminal's "Before December 31" panel. US resident: FIFO lots per account, short vs long term, this year's realized gains, the year netted as Schedule D nets it (the $3,000 off ordinary income, the carryforward), and the wash-sale rule across every account, IRA and 401(k) included: losses it took this year, windows still open, and the first day the same security can be bought back without one (IRS Publication 550). French resident: weighted average cost across accounts at ECB rates, PEA and crypto left out, and the flat tax those losses erase against this year's net gains (CGI art. 150-0 D, 200 A). Funds on the same index are flagged, never judged "substantially identical". Current prices are fetched unless given in prices. Nothing is stored. Use it for "how much tax can my losses save before December 31", "would this be a wash sale".

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": {
      "residence": "<residence>",
      "lots": "<lots>"
    },
    "name": "tax_loss_harvest"
  }
}

Input Schema

NameRequiredDescriptionDefault
lotsYesEvery purchase of the shares held, one per lot; add this year's sales (side "sell") with the purchases they came from, so realized gains and wash sales count. At most 300.
pricesNoCurrent price per share by ticker, in the lots' currency, when the user gave it. Tickers left out are priced from Yahoo Finance. At most 150.
carryoverNoUS only: capital losses carried into this year from last year's return, in dollars, by term.
residenceYesWhere the user pays tax: US or FR (France).
filing_statusNoUS only: Form 1040 filing status (default single). Married filing separately caps the deduction at $1,500.

Output Schema

NameRequiredDescriptionDefault
usNo
urlYes
asOfYes
rowsYes
ruleYes
yearYes
leftOutYes
currencyYes
daysLeftYes
lossTotalYes
notAdviceNo
residenceYes
approximateNo
flatTaxRateNo
realizedNetYes
taxErasableNo
substantiallyIdenticalNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior5/5

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

The description adds meaningful behavioral detail beyond the annotations: it states that nothing is stored, that current prices are fetched unless supplied in `prices`, and that wash-sale and tax-treatment rules are applied across every account including IRAs and 401(k)s. It also discloses that funds on the same index are flagged but never judged "substantially identical," which prevents the agent from overreading the output.

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 purpose is front-loaded and the density is justified by the complexity of the tax rules being described. However, the main body is a long, clause-heavy sentence that could be broken up for easier scanning.

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?

Given the complex domain, rich input schema, annotations, and output schema, the description is complete enough for an agent to call the tool correctly. It covers residency-specific behavior, wash-sale handling, price fetching, and the fact that no data is stored.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the nested lot fields, `prices`, `carryover`, `residence`, and `filing_status` are already well documented in the schema. The description adds some high-level context about the lot array and the need to include sales, but it does not add much meaning beyond the structured fields.

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?

The description opens with a specific verb and resource: it computes realized losses on user-provided lots for a sale before December 31 and explains what those losses offset. It clearly distinguishes the US and French tax regimes and is unmistakable relative to the sibling tools, none of which are tax-loss harvesting calculators.

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 gives explicit use cases: "how much tax can my losses save before December 31" and "would this be a wash sale." It does not state when not to use it or name an alternative tool, but the context is clear enough that an agent can infer appropriate use.

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