Skip to main content
Glama

Prepare margin add

perps_prepare_margin_add
Read-only

Previews adding margin to an open position. Read-only safety gate: runs risk checks and returns a short-lived confirmation token (~90s). Present the summary, get explicit user confirmation, then call perps_execute_operation with the token. Makes no changes itself. Check perps_get_margin_add_limits first; execution is async, so poll perps_get_margin_task_status with the returned task_id.

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": {
      "contractId": "<contractId>"
    },
    "name": "perps_prepare_margin_add"
  }
}

Input Schema

NameRequiredDescriptionDefault
isMaxNoAdjust by the maximum amount the position allows, ignoring amount.
amountNoMargin to be added to the position, in USDT, as a decimal string. Required unless isMax is true. Below the contract's minimum adjust amount, execution fails with agent.margin.invalid_amount.
contractIdYesNumeric contract id from perps_list_contracts with an open position. 0 is a real contract id, not a placeholder for "unset".

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, and the description reinforces that with "Makes no changes itself" while adding details annotations cannot carry: risk checks run, the returned confirmation token is short-lived (~90s), explicit user confirmation is required, and execution downstream is asynchronous. This is materially richer than the structured fields.

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?

Six short sentences, front-loaded with the purpose and then walking the workflow in execution order. Each clause carries a distinct operational fact (token lifetime, user confirmation, async polling) with no filler.

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?

Although there is no output schema, the description tells the agent what comes back (a short-lived confirmation token, and a task_id for polling) and what to do with it. For a three-parameter preparatory tool, no operational gap remains.

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 coverage is 100%, so the schema already documents contractId, amount and isMax with useful detail (minimum adjust amount, isMax overriding amount, contractId 0 being valid). The description does not add any further parameter meaning, so the baseline of 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 ("Previews adding margin to an open position") and explicitly frames the tool as a read-only, no-side-effect safety gate, which cleanly separates it from perps_execute_operation. An agent can identify what this does and what it does not do 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 Guidelines5/5

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

It spells out the full sequence: call perps_get_margin_add_limits first, invoke this to get a token, present the summary and obtain explicit user confirmation, then call perps_execute_operation with the token, then poll perps_get_margin_task_status. Both prerequisites and follow-on steps name concrete siblings, leaving nothing to inference.

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