Skip to main content
Glama
Factor MCP Server

Factor MCP Server

Official
by FactorDAO

factor_hl_close_position

Close or reduce a HyperLiquid perpetual position in USD through a Factor vault on HyperEVM (chain 999). Handles main-dex symbols on-chain and HIP-3 builder-dex symbols via the HL Exchange API.

Instructions

Reduce / close a HyperLiquid perp position (reduce-only order) sized in USD through a Factor vault. HyperEVM (chain 999) only. Main-dex symbols (BTC, ETH, ...) route on-chain; HIP-3 builder-dex symbols (xyz:GOLD, xyz:BRENTOIL, ...) route off-chain via the HL Exchange API.

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": {
      "vault": "<vault>",
      "perp": "<perp>",
      "sizeUsd": "<sizeUsd>"
    },
    "name": "factor_hl_close_position"
  }
}

Input Schema

NameRequiredDescriptionDefault
perpYesPerp symbol. Main dex: "ETH", "BTC", "SOL". Builder dex (HIP-3): "xyz:GOLD", "xyz:BRENTOIL", ...
vaultYesVault contract address.
sizeUsdYesNotional USD to close (reduce-only).
passwordNoWallet password if encrypted.
slippageBpsNoMax slippage in bps. Default 1000.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.7.9

TDQS

A4.1/5.0
Behavior3/5

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

With no annotations at all, the description carries the full disclosure burden, and it does explain that the order is reduce-only and that HIP-3 builder-dex symbols are routed off-chain via the HL Exchange API — meaningful behavioral detail. It omits prerequisites (must a position exist?), auth expectations despite a password param, failure/partial-fill behavior, and what is returned, which is thin for a value-moving tool.

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?

Three dense sentences, front-loaded with the core action, then constraints, then routing rule. No filler or restatement of the tool name.

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

Completeness3/5

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

For a mutation tool with no annotations and no output schema, the definition covers chain scoping and routing well but leaves gaps around prerequisites, authentication (the password parameter is unexplained here), and post-call state. Adequate but not complete for a position-closing operation.

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 the baseline is 3, and the description earns above baseline by explaining that sizeUsd is a reduce-only notional and by defining the two symbol families that the perp parameter accepts. Slippage, password, and vault semantics are still left entirely to the schema.

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 and resource ("Reduce / close a HyperLiquid perp position") plus the mechanism (reduce-only order via a Factor vault) and scope (chain 999, main-dex vs builder-dex routing). This is enough to tell it apart from the open-position and order-placing siblings without opening any 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?

Gives clear operating context: reduce-only sizing, HyperEVM chain 999 only, and which symbol families get routed on-chain versus off-chain. It does not, however, say when to prefer this over the sibling compile-then-execute path (factor_hl_compile_close) or state what happens if no position exists.

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

Deploy Server

Other Tools