Skip to main content
Glama

record_existing_position

Destructive

Backfill positions you already held before onboarding, without touching ledger cash. Record units and average cost so existing holdings are counted once in your portfolio.

Instructions

Record a position the user already held before using openInvest (onboarding backfill) WITHOUT touching ledger cash. History is marked funding_source: external_funding, source: mcp:existing_position.

Only for positions that status does not list yet — calling it for a symbol already there adds the units again (double count). A new purchase paid from ledger cash is buy. Does not add the symbol to the tracked list; use track_asset for committee coverage.

Args: symbol: yfinance ticker (e.g. "AAPL", "510300.SS"). Gold = "GC=F", booked in CNY per gram only (units = grams, currency "CNY", kind "metal", unit_label "克"). units: Quantity held; must be > 0. price: Average cost per unit, in currency. currency: Currency of price; omitted = the existing position's currency (CNY if new). kind: Asset kind tag: "equity", "etf", "metal" (gold), "crypto", "bond", "fund", "other". unit_label: Human display label for units (default "股", i.e. shares). idempotency_key: Reuse the same key when retrying this exact call; recorded once.

Returns: Updated position summary, or {"status": "error", "error": ...}.

Input Schema

NameRequiredDescriptionDefault
kindNoAsset kind tag: 'equity', 'etf', 'metal' (gold), 'crypto', 'bond', 'fund', 'other'.equity
priceYesAverage cost per unit, in `currency`.
unitsYesQuantity held; must be > 0.
symbolYesyfinance ticker, e.g. 'AAPL', '510300.SS'. Gold is 'GC=F' and must be booked per gram in CNY: units = grams, price = CNY/gram, currency='CNY', kind='metal', unit_label='克' (USD/oz bookings are rejected).
currencyNoCurrency of `price`, e.g. 'CNY', 'USD', 'AUD'. Omit to use the existing position's currency (CNY for a new position); a different currency than the position's is rejected.
unit_labelNoHuman display label for units (default '股', i.e. shares).股
idempotency_keyNoOptional client-generated key (e.g. a UUID4). When retrying this SAME call after a timeout or an unknown result, reuse the same key: the ledger records it once and later calls return {"status": "duplicate"} without touching cash or holdings. Only the key is compared, not the arguments — a different order (other symbol/units/price/amount) needs a new key, or it is silently treated as the retry.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.45.1
    • addedInput schema / properties / idempotency_key
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Optional client-generated key (e.g. a UUID4). When retrying this SAME call after a timeout or an unknown result, reuse the same key: the ledger records it once and later calls return {\"status\": \"duplicate\"} without touching cash or holdings. Only the key is compared, not the arguments — a different order (other symbol/units/price/amount) needs a new key, or it is silently treated as the retry.",
      +  "title": "Idempotency Key"
      +}
    • changedInput schema / properties / kind / description
      Previous value: -"Asset kind tag, e.g. 'equity', 'etf', 'commodity'."New value: +"Asset kind tag: 'equity', 'etf', 'metal' (gold), 'crypto', 'bond', 'fund', 'other'."
    • changedInput schema / properties / symbol / description
      Previous value: -"yfinance ticker, e.g. 'AAPL', '510300.SS', 'GC=F'."New value: +"yfinance ticker, e.g. 'AAPL', '510300.SS'. Gold is 'GC=F' and must be booked per gram in CNY: units = grams, price = CNY/gram, currency='CNY', kind='metal', unit_label='克' (USD/oz bookings are rejected)."
  2. Changed4 schema fields changedv0.42.4
    • addedInput schema / properties / currency / anyOf
      Added value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / currency / default
      Previous value: -"CNY"New value: +null
    • changedInput schema / properties / currency / description
      Previous value: -"Currency of `price`, e.g. 'CNY', 'USD', 'AUD'."New value: +"Currency of `price`, e.g. 'CNY', 'USD', 'AUD'. Omit to use the existing position's currency (CNY for a new position); a different currency than the position's is rejected."
    • removedInput schema / properties / currency / type
      Removed value: -"string"
  3. Addedv0.41.2

TDQS

A4.5/5.0
Behavior5/5

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

Despite annotations covering readOnly=false/destructive=true, the description adds substantial behavior the annotations cannot convey: no cash is touched, history is tagged `funding_source: external_funding` / `source: mcp:existing_position`, duplicate calls double-count unless retried with the same idempotency key, and the symbol is not added to the tracked list. This is consistent with idempotentHint=false rather than contradicting it.

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

Conciseness3/5

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

The purpose paragraph is well front-loaded and high value, but the trailing Args/Returns block repeats schema descriptions verbatim (units, price, currency, kind, unit_label, idempotency_key) at 100% coverage, inflating an otherwise tight definition for no new information.

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?

An output schema exists, yet the description still surfaces the error envelope; combined with the cash-neutrality guarantee, duplicate-counting hazard, gold booking convention, and alternatives, nothing material an agent needs to call this 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%, so all seven parameters (including the gold-in-CNY-per-gram rule and the idempotency_key semantics) are already documented in the schema. The Args block largely restates those same descriptions, adding little that isn't already structured, 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?

States a specific verb+resource (record an already-held position) with its precise niche: onboarding backfill, no ledger cash movement. It explicitly distinguishes itself from `buy` (new purchase from cash) and `track_asset` (committee coverage), so an agent can route without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit when (positions the user held before openInvest, not yet in `status`) and an explicit when-not (calling it for a symbol already in `status` adds units again — double count). It also names the two alternative tools and the conditions that select them.

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