Skip to main content
Glama

Close position (agent wallet)

hl_close_position
Destructive

Close an open perpetual position using a reduce-only market order through your local agent wallet. Dry-run by default; set confirm=true and dryRun=false to execute.

Instructions

Close an open perp position with a reduce-only market (IOC) order via your local agent wallet, builder code attached. Dry-run by default; set confirm=true AND dryRun=false to submit. Irreversible; not investment advice.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coinYesPerp coin symbol of the position to close.
dryRunNo
addressNoAccount holding the position; defaults to the agent wallet address.
confirmNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeYes
actionYes
reasonNo
responseNo
agentAddressNo
builderAttachedYes
Behavior4/5

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

Annotations already mark destructiveHint=true. The description adds behavioral details: 'reduce-only market (IOC) order', 'builder code attached', 'dry-run by default', and 'irreversible'. These go beyond the annotations by specifying order type and execution mode.

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?

Two concise sentences. First sentence states the action, second provides critical usage conditions and a warning. No wasted words.

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?

With 4 parameters, 50% schema coverage, and an output schema present, the description covers the main purpose, usage conditions, and a key behavioral warning. It could mention the return value or further details about 'builder code', but it is sufficient for an agent to use correctly.

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 description coverage is 50%, so baseline is 3. The description clarifies the dryRun and confirm parameters by stating the dry-run default and the condition to submit, adding meaning beyond the schema's defaults. It also implies the address parameter via 'local agent wallet'. However, it does not explicitly describe all parameters.

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 the verb 'close' and the resource 'open perp position' via a reduce-only market order. It distinguishes from siblings like hl_place_order by being specific to closing positions. No ambiguity.

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?

Explicitly states the dry-run default and the condition to submit (confirm=true AND dryRun=false). Warns that it is irreversible. However, it does not explicitly state when not to use this tool versus alternatives like hl_place_order, though the context is clear.

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/johnsmithxy1mmm-sys/HyperliquidMCP'

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