Skip to main content
Glama
zionto

ibkr-mcp

by zionto

flex_analyze_pnl

Aggregate realized profit and loss from Interactive Brokers Flex XML trade reports. Group by symbol, month, year, asset category, or buy/sell, and filter by date or asset type to get a sorted breakdown.

Instructions

Aggregate realized P&L from trade records in a Flex XML report.

Only closing trades (open_close contains 'C') contribute to realized P&L.

Args: xml_content: Raw Flex XML string. group_by: Dimension to aggregate by — "symbol", "month", "year", "asset_category", or "buy_sell" (default "symbol"). asset_category: Filter by asset category e.g. STK, OPT, FUT (optional). from_date: Earliest trade date, YYYY-MM-DD (optional). to_date: Latest trade date, YYYY-MM-DD (optional).

Returns JSON with totals and a breakdown list sorted by realized_pnl descending.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
to_dateNo
group_byNosymbol
from_dateNo
xml_contentYes
asset_categoryNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It does well by stating the closing-trade filter, the date/asset filters, the group-by options, and the return format (JSON totals plus a breakdown sorted by realized_pnl descending). It stops short of discussing error handling or malformed input, but the core behavioral traits are transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured: a single purpose sentence, an important note about closing trades, then a clear Args list, and a Returns line. Every sentence adds value without redundancy. It is appropriately sized for a tool with five parameters.

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 that an output schema exists (though not shown in the prompt), the description need not explain return values in depth, but it still summarizes the return shape. It covers all parameters, the behavioral rule about closing trades, and the available grouping/filter dimensions, making it complete for an agent to select and invoke the tool correctly.

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

Parameters5/5

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

Schema description coverage is 0%, but the description fully compensates by documenting every parameter with names, types, defaults, examples, and format requirements (e.g., 'YYYY-MM-DD', 'STK, OPT, FUT', allowed group_by values). This is exactly the kind of semantic enrichment the rubric rewards.

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 uses a specific verb and resource: 'Aggregate realized P&L from trade records in a Flex XML report.' It also clarifies a key filtering rule ('Only closing trades... contribute'), which clearly distinguishes this tool from sibling analysis tools focusing on dividends, cash utilization, or portfolio history.

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?

The description gives clear context for when to use the tool: for realized P&L aggregation from trade records, with only closing trades contributing. It does not explicitly mention alternatives or exclusions, but the intended use case is sufficiently clear given the sibling tool names and the stated filter behavior.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zionto/ibkr-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server