Skip to main content
Glama
Liquidiction

Liquidiction

get_recent_trades

Retrieve recent trades for any HIP-4 prediction market outcome on Hyperliquid by providing a coin identifier.

Instructions

Get recent trades for a prediction market outcome

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coinYesCoin identifier, e.g. "#90"

Implementation Reference

  • The handler function for 'get_recent_trades' tool. Calls the Hyperliquid API with type 'recentTrades' for the given coin, filters for outcome trades (coin starting with '@'), and returns up to the 50 most recent trades formatted as timestamp, side, size, and price percentage.
      async ({ coin }) => {
        const trades = await hlInfo<RecentTrade[]>({
          type: 'recentTrades',
          coin: coinToAtFormat(coin),
        });
    
        const outcomeTrades = trades.filter(t => t.coin.startsWith('@'));
    
        if (outcomeTrades.length === 0) {
          return { content: [{ type: 'text', text: 'No recent trades found.' }] };
        }
    
        const lines = outcomeTrades.slice(0, 50).map(t => {
          const time = new Date(t.time).toISOString().slice(0, 19);
          return `${time} ${t.side.toUpperCase()} ${t.sz} @ ${(parseFloat(t.px) * 100).toFixed(1)}%`;
        });
    
        return { content: [{ type: 'text', text: lines.join('\n') }] };
      },
    );
  • TypeScript interface for the RecentTrade data structure returned by the HL API and used by the handler.
    interface RecentTrade {
      coin: string; side: string; px: string; sz: string; time: number; hash: string; tid: number;
    }
  • mcp-server.ts:308-332 (registration)
    Registration of the 'get_recent_trades' tool on the MCP server using server.tool(), with a single 'coin' string parameter described as 'Coin identifier, e.g. "#90"'.
    // --- get_recent_trades ---
    server.tool(
      'get_recent_trades',
      'Get recent trades for a prediction market outcome',
      { coin: z.string().describe('Coin identifier, e.g. "#90"') },
      async ({ coin }) => {
        const trades = await hlInfo<RecentTrade[]>({
          type: 'recentTrades',
          coin: coinToAtFormat(coin),
        });
    
        const outcomeTrades = trades.filter(t => t.coin.startsWith('@'));
    
        if (outcomeTrades.length === 0) {
          return { content: [{ type: 'text', text: 'No recent trades found.' }] };
        }
    
        const lines = outcomeTrades.slice(0, 50).map(t => {
          const time = new Date(t.time).toISOString().slice(0, 19);
          return `${time} ${t.side.toUpperCase()} ${t.sz} @ ${(parseFloat(t.px) * 100).toFixed(1)}%`;
        });
    
        return { content: [{ type: 'text', text: lines.join('\n') }] };
      },
    );
  • Helper utility that converts a coin identifier (e.g. '#90') to the '@' format expected by the Hyperliquid API (e.g. '@90'), used in the handler when calling hlInfo.
    function coinToAtFormat(coin: string): string {
      const num = coin.startsWith('#') ? coin.slice(1) : coin;
      return `@${num}`;
    }
  • Generic helper that posts to the Hyperliquid /info API endpoint and returns typed JSON. Used by the handler to fetch recentTrades data.
    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?

The description lacks important behavioral details such as the time range of 'recent', pagination, or response structure. With no annotations and no output schema, the agent has minimal insight into side effects or data constraints.

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?

The description is a single, well-structured sentence that front-loads the action and resource, with no redundant or extraneous content.

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

Completeness2/5

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

The description is too minimal for a tool with no output schema and no annotations. It fails to explain what constitutes 'recent' or what fields the result contains, leaving the agent underinformed about the tool's behavior.

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?

While the input schema covers 100% of parameters, the description adds context by linking the 'coin' parameter to a 'prediction market outcome', clarifying its semantic role beyond the schema's generic identifier description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get recent trades') and the target resource ('prediction market outcome'), making the purpose immediately understandable. However, it does not differentiate from sibling tools that also retrieve market data, such as get_candles or get_orderbook.

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 is provided on when to use this tool versus alternatives like get_candles or get_prices. The agent is left to infer the appropriate context from the tool name alone.

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