Skip to main content
Glama
aiordanescu

ib-gateway-mcp

by aiordanescu

Account P&L

get_pnl
Read-only

Fetch live account P&L (daily, unrealized, realized) in base currency. Get a fresh one-shot reading without managing subscriptions.

Instructions

Return the account's live P&L: today's (daily), unrealized and realized, in base currency.

One-shot: subscribes to IBKR's P&L feed, waits a few seconds at most for the first
update (usually about a second), and cancels, so every call is a fresh reading and
nothing needs unsubscribing. Errors: request_timeout when IBKR sends nothing (right
after login, or an account without data); retry once before giving up.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountNoIBKR account id, e.g. DU1234567. Omit to use the default account; list_accounts shows which accounts are allowed.
model_codeNoFinancial-advisor model code, to scope the result to one model portfolio. Omit for the whole account (normal for non-advisor accounts).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
as_ofYesWhen this server read the values (UTC); IBKR refreshes P&L about every second.
accountYes
daily_pnlNoP&L since the start of today's session.
model_codeNo
realized_pnlNoClosed P&L today.
unrealized_pnlNoOpen-position P&L.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Beyond the readOnlyHint annotation, the description discloses the entire behavioral profile: one-shot subscription, wait time (a few seconds, usually about one), automatic cancellation, fresh reading per call, no need to unsubscribe, and error behavior (request_timeout after login or for data-less accounts, retry once). This is rich, non-obvious context that the agent needs to anticipate network behavior.

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 front-loaded with the core purpose in the first sentence, then packs the behavioral contract into a compact second block. There is no filler, and every sentence covers a distinct aspect: purpose, subscription lifecycle, and error handling.

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?

The tool has an output schema, so return values are covered there. The description provides the remaining context: base currency, P&L components, timing, one-shot semantics, and error behavior. Nothing an agent needs to call it correctly is missing.

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%, with both parameters (account and model_code) already well documented. The description adds no additional parameter-specific meaning beyond what the schema provides, so the baseline 3 applies.

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: 'Return the account's live P&L: today's (daily), unrealized and realized, in base currency.' This precisely identifies what is returned and distinguishes the tool from per-position P&L (get_position_pnl) and account summaries. The scope is clear and immediately usable by an agent.

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: it is a one-shot snapshot that subscribes, waits for the first update, and cancels, so the agent knows it is not a continuous subscription and does not require explicit unsubscription. It also describes error handling and a retry. However, it does not explicitly name alternatives or state when-not-to-use, leaving the distinction from siblings like get_position_pnl to inference from the 'account's live P&L' phrase.

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