Skip to main content
Glama

Tapetide - Indian Stock Market MCP

Update Portfolio Stock

update_portfolio_stock
Destructive

Update the quantity and/or average price of an existing stock in the user's portfolio.

Use cases: • User says "I bought 10 more RELIANCE at ₹1,400" → you must calculate the new total qty and weighted avg price, then call this tool • User says "Change my TCS quantity to 50" → direct update • User says "I sold 5 shares of INFY" → reduce quantity (calculate new qty = old - 5)

IMPORTANT workflow for additional purchases:

  1. First call get_user_portfolio to get current quantity and avg_price

  2. Calculate: new_qty = old_qty + additional_qty

  3. Calculate: new_avg = (old_qty × old_avg + additional_qty × purchase_price) / new_qty

  4. Call this tool with the NEW total quantity and NEW weighted average price

For partial sells:

  1. new_qty = old_qty - sold_qty (avg_price stays the same)

  2. If new_qty = 0, use remove_portfolio_stocks instead

Both quantity and avg_price are required — always provide the final values.

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": {
      "symbol": "<symbol>",
      "quantity": "<quantity>",
      "avg_price": "<avg_price>"
    },
    "name": "update_portfolio_stock"
  }
}

Input Schema

NameRequiredDescriptionDefault
symbolYesStock symbol to update (e.g. RELIANCE)
quantityYesNew TOTAL quantity (not the additional amount)
avg_priceYesNew average buy price per share in ₹
portfolioNoOptional. The portfolio's name or id, from the index get_user_portfolio returns. Omit to use the default portfolio.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / portfolio
      Added value: +{
      +  "description": "Optional. The portfolio's name or id, from the index get_user_portfolio returns. Omit to use the default portfolio.",
      +  "type": "string"
      +}
  2. First observed

TDQS

A4.3/5.0
Behavior4/5

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

The annotations already declare this as a non-read-only, destructive, non-idempotent mutation, and the description adds substantial behavioral context beyond that: it requires final total values, explains calculating weighted average price, and says when to switch to remove_portfolio_stocks. It does not explicitly say existing values are overwritten with no undo, but the final-value workflow makes the mutation behavior clear enough.

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 definition is front-loaded with purpose and structured into use cases, purchase workflow, sell workflow, and a required-values reminder. It is somewhat long and repeats the purchase/sell logic between use cases and workflow sections, but the structure is clear and the detail is mostly functional for a calculation-heavy mutation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given a four-parameter mutation with no output schema, the description covers the important invocation behavior: prerequisites, calculations, final values, and the zero-quantity alternative. The main remaining gaps are no explicit add_portfolio_stocks routing for new stocks, no mention of the optional portfolio parameter, and no return-value or failure behavior.

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?

With 100% schema description coverage, the baseline is 3, but the description adds meaningful derivation semantics for quantity and avg_price: quantity is the new total, not the additional amount, and the weighted-average formula must be used after fetching current holdings. It does not explain the optional portfolio parameter beyond what the schema already says.

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 states a specific verb and resource: update the quantity and/or average price of an existing stock in the user's portfolio. It also scopes the operation to existing holdings and explicitly names remove_portfolio_stocks as the alternative when quantity reaches zero, so it is distinguishable from the delete/removal sibling.

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 clear when-to-use guidance through three concrete use cases, plus detailed workflows for additional purchases and partial sells. It also names get_user_portfolio as a prerequisite and remove_portfolio_stocks as an alternative when the resulting quantity is zero, though it does not explicitly route new-stock additions to add_portfolio_stocks.

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.