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.

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 ₹

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior4/5

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

Annotations declare destructiveHint=true and non-idempotent, so the mutation profile is already carried structurally. The description adds genuine context beyond that: both fields must always be supplied as final values, existing values are replaced via weighted-average recomputation, and the zero-quantity edge case routes to removal. It stops short of stating permissions or exactly what is overwritten on the record.

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?

Front-loaded purpose sentence, then clearly delineated use-case and numbered-workflow blocks. Slightly long for a three-parameter tool, but nearly every line carries operational content (formulas, edge case, alternative) rather than filler, so the length largely earns its place.

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?

For a destructive mutation with no output schema, the description supplies the prerequisite call, the arithmetic the agent must do, and the zero-quantity escape hatch, which is close to a full operating procedure. Minor remaining gap is the absence of any statement about the response/confirmation or auth requirements.

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?

Schema coverage is 100% (baseline 3), but the description adds real semantic value the schema lacks: the weighted-average formula, the distinction between additional vs total quantity, and the invariant that avg_price is unchanged on a sell. That is meaning beyond the field-level text.

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?

Specific verb+resource ('Update the quantity and/or average price of an existing stock') with immediate scope narrowing to an existing position. The use-case bullets and workflow make it unmistakable versus add_portfolio_stocks (new positions) and remove_portfolio_stocks (zeroing out), both of which it names.

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?

Explicit when-to-use via three natural-language user phrasings, plus concrete formulas for both purchase and partial-sell scenarios. It names the alternative (remove_portfolio_stocks) and the exact condition that selects it (new_qty = 0), and it mandates the get_user_portfolio prerequisite step.

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.