Skip to main content
Glama

Prepare: sell a stock

sell_stock
Read-onlyIdempotent

Unsigned transactions for a plain spot sale: a stock token held in the wallet is sold for USDG on Uniswap, through the stock's own pools, and the USDG arrives in the wallet (an amount, or everything the wallet holds with all: true). Stock lent on Borro is not in the wallet: withdraw takes it back first. Exact in: all of the amount is sold and at least the quote less slip_bps arrives, or nothing is sold. Borro's fee, the same as the site's Buy tab takes, comes out of the USDG inside the swap (fee_usdg and fee_bps in the quote). Exact approvals first when they are missing: the stock to Permit2 (Uniswap's approval contract), then Permit2's allowance for Uniswap's Universal Router, which lapses after 30 minutes. Priced now; simulated from the wallet in order.

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": {
      "wallet": "<wallet>",
      "symbol": "<symbol>"
    },
    "name": "sell_stock"
  }
}

Input Schema

NameRequiredDescriptionDefault
allNoSell everything the wallet holds of it
amountNoStock to sell, in whole units as a decimal string, like "1.5"
symbolYesA stock on Borro by its ticker, like NVDA or AAPL (markets lists every one)
walletYesThe wallet's address (0x...); the transactions are built for it to sign
slip_bpsNoMost the price may move against the quote, in hundredths of a percent (default 50, 0.5%)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, and the description adds substantial behavior beyond them: exact-in execution with 'all of the amount is sold and at least the quote less slip_bps arrives, or nothing is sold', the fee extracted from the USDG inside the swap, required approvals to Permit2 and the Universal Router with 30-minute lapse, and that transactions are priced now and simulated from the wallet in order. This is exactly the pre-call context an agent needs and it is consistent with the declared annotations.

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?

It is front-loaded with the core action and the critical execution semantics, and each sentence carries distinct information (mechanics, lent-stock caveat, exact-in rule, fees, approvals, pricing/simulation). The sentences are long and jargon-dense, which costs some readability, but there is little true waste.

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?

For a multi-step DeFi preparation tool with five parameters and no output schema, the description covers approvals, slippage, fee treatment, atomicity/partial-fill behavior, ordering of simulated transactions, and the lent-stock prerequisite. Nothing an agent needs in order 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.

Parameters4/5

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

Schema coverage is 100%, so baseline is 3; the description nevertheless adds meaning by tying 'all: true' to selling everything the wallet holds and explaining that slip_bps bounds how far the price may move ('at least the quote less slip_bps arrives'). It also references quote fields fee_usdg and fee_bps that situate the parameters in the broader flow, though it does not clarify the amount-vs-all mutual exclusivity explicitly.

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+resource: 'Unsigned transactions for a plain spot sale' where 'a stock token held in the wallet is sold for USDG on Uniswap, through the stock's own pools'. The word 'plain' implicitly distinguishes it from leveraged/option/pair siblings, and the destination of funds (USDG in the wallet) is stated, so an agent can tell what it produces without opening the schema.

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 a clear when-to-use context (spot sale of a wallet-held stock token) and explicitly names the prerequisite alternative: 'Stock lent on Borro is not in the wallet: withdraw takes it back first.' It does not name the opposite case (when to use buy_stock or another sell variant), so it stops short of full when/when-not coverage.

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.

Resources