Skip to main content
Glama
talkincode

HyperLiquid MCP Server

by talkincode

close_position

Close open positions on HyperLiquid by specifying a coin and percentage. Handles both full and partial closure using market or limit orders.

Instructions

Close a position (full or partial)

Args: coin: Trading pair (e.g., "BTC", "ETH") percentage: Percentage of position to close (default: 100.0 for full close)

Note: For 100% closure, uses market_close_position for optimal execution. For partial closure, you'll need to use limit orders as HyperLiquid's market_close closes all positions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coinYes
percentageNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior3/5

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

With no annotations, the description carries the burden. It adds useful behavioral context about how full closures are executed (via market_close_position) and the limitation of HyperLiquid's market_close for partial closures. However, it leaves ambiguous whether the tool itself places limit orders or instructs the user to do so, undermining full transparency.

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 description is well-structured with Args and Note sections, and is appropriately concise. The note is informative but could be clearer, especially regarding partial closures, so it loses one point.

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?

The description covers the core functionality and alternatives, but the ambiguity about partial closure execution is a significant gap. It does not fully clarify whether this tool can be used for partial closures or if the user must place limit orders separately, which is essential for a trading tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

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

The input schema only lists 'coin' (string) and 'percentage' (number) with a default, but the description provides essential semantics: 'coin: Trading pair (e.g., BTC, ETH)' and 'percentage: Percentage of position to close (default: 100.0 for full close).' This adds meaning beyond the schema, satisfying the 0% coverage gap.

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 clearly states 'Close a position (full or partial)' with a specific verb and resource. It distinguishes itself from sibling tools by mentioning 'uses market_close_position for optimal execution' and discussing partial closure, which is unique compared to market_close_position.

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?

Guidance is provided: 'For 100% closure, uses market_close_position for optimal execution' and 'For partial closure, you'll need to use limit orders as HyperLiquid's market_close closes all positions.' This names alternatives and conditions, though the ambiguity about whether the tool itself handles partial closures via limit orders slightly reduces clarity.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/talkincode/hyperliquid-mcp-python'

If you have feedback or need assistance with the MCP directory API, please join our Discord server