Skip to main content
Glama
Liquidiction

Liquidiction

get_user_positions

Retrieve current outcome share positions for any Hyperliquid user by providing their wallet address.

Instructions

Get current outcome share positions for a user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesUser wallet address

Implementation Reference

  • mcp-server.ts:221-222 (registration)
    Registration of the 'get_user_positions' tool with the MCP server via server.tool().
    server.tool(
      'get_user_positions',
  • Handler function for 'get_user_positions'. Calls HL API 'spotClearinghouseState' and 'allMids', filters for outcome coins (# prefix) with non-zero balances, computes share values, and returns formatted text output.
    // --- get_user_positions ---
    server.tool(
      'get_user_positions',
      'Get current outcome share positions for a user',
      { address: z.string().describe('User wallet address') },
      async ({ address }) => {
        const [spotState, mids] = await Promise.all([
          hlInfo<{ balances: { coin: string; total: string }[] }>({ type: 'spotClearinghouseState', user: address }),
          hlInfo<Record<string, string>>({ type: 'allMids' }),
        ]);
    
        const positions = spotState.balances
          .filter(b => b.coin.startsWith('#') && parseFloat(b.total) !== 0)
          .map(b => {
            const shares = parseFloat(b.total);
            const price = mids[b.coin] ? parseFloat(mids[b.coin]) : 0;
            const value = shares * price;
            return `${b.coin}: ${shares.toFixed(0)} shares @ ${(price * 100).toFixed(1)}% = $${value.toFixed(2)}`;
          });
    
        if (positions.length === 0) {
          return { content: [{ type: 'text', text: 'No outcome positions.' }] };
        }
    
        return { content: [{ type: 'text', text: positions.join('\n') }] };
      },
    );
  • Input schema: accepts a single 'address' parameter (string) describing the user wallet address.
    { address: z.string().describe('User wallet address') },
  • The hlInfo helper function used to make all HL API calls, including those in get_user_positions.
    async function hlInfo<T>(body: object): Promise<T> {
      const res = await fetch(`${API_URL}/info`, {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(body),
      });
      if (!res.ok) throw new Error(`HL API error: ${res.status}`);
      return res.json() as Promise<T>;
    }
Behavior2/5

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

No annotations are provided, and the description does not disclose behavioral traits such as idempotency, authentication requirements, or rate limits. The description is minimal.

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?

Single sentence, no wasted words. Efficiently conveys the tool's purpose.

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 simple read tool with one parameter and no output schema, the description is minimally adequate. However, it lacks usage context and behavioral details that would help an agent.

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% with a single parameter 'address' described as 'User wallet address'. The description adds no extra meaning beyond the schema, so baseline score of 3 is appropriate.

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 states the specific verb 'Get' and resource 'current outcome share positions' for a user, clearly differentiating from siblings like get_open_orders or get_user_fills which deal with orders or fills.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives. For example, it does not explain when to use this vs get_user_fills or get_open_orders.

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/Liquidiction/liquidiction-mcp'

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