Skip to main content
Glama
Liquidiction

Liquidiction

get_user_fills

Fetch the trade history for a user wallet address, specifying the number of fills to return.

Instructions

Get trade history for a user address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesUser wallet address
limitNoMax number of fills to return

Implementation Reference

  • mcp-server.ts:176-197 (registration)
    Registration of the 'get_user_fills' tool via server.tool() with Zod schema for address (string) and limit (number, default 20).
    server.tool(
      'get_user_fills',
      'Get trade history for a user address',
      { address: z.string().describe('User wallet address'), limit: z.number().default(20).describe('Max number of fills to return') },
      async ({ address, limit }) => {
        const fills = await hlInfo<UserFill[]>({ type: 'userFills', user: address });
        const outcomeFills = fills.filter(f => f.coin.startsWith('#')).slice(0, limit);
    
        if (outcomeFills.length === 0) {
          return { content: [{ type: 'text', text: 'No outcome trades found for this address.' }] };
        }
    
        const lines = outcomeFills.map(f => {
          const date = new Date(f.time).toISOString().slice(0, 19);
          const pnl = parseFloat(f.closedPnl);
          const pnlStr = pnl !== 0 ? ` PnL: ${pnl > 0 ? '+' : ''}$${pnl.toFixed(2)}` : '';
          return `${date} ${f.side.toUpperCase()} ${f.coin} ${f.sz} @ ${(parseFloat(f.px) * 100).toFixed(1)}%${pnlStr}`;
        });
    
        return { content: [{ type: 'text', text: lines.join('\n') }] };
      },
    );
  • Handler function that calls HL API 'userFills', filters for outcome coins (# prefix), slices to limit, and formats output with date, side, coin, size, price, and PnL.
      async ({ address, limit }) => {
        const fills = await hlInfo<UserFill[]>({ type: 'userFills', user: address });
        const outcomeFills = fills.filter(f => f.coin.startsWith('#')).slice(0, limit);
    
        if (outcomeFills.length === 0) {
          return { content: [{ type: 'text', text: 'No outcome trades found for this address.' }] };
        }
    
        const lines = outcomeFills.map(f => {
          const date = new Date(f.time).toISOString().slice(0, 19);
          const pnl = parseFloat(f.closedPnl);
          const pnlStr = pnl !== 0 ? ` PnL: ${pnl > 0 ? '+' : ''}$${pnl.toFixed(2)}` : '';
          return `${date} ${f.side.toUpperCase()} ${f.coin} ${f.sz} @ ${(parseFloat(f.px) * 100).toFixed(1)}%${pnlStr}`;
        });
    
        return { content: [{ type: 'text', text: lines.join('\n') }] };
      },
    );
  • Zod schema definitions for the input parameters: address (required string) and limit (optional number, default 20).
    'Get trade history for a user address',
    { address: z.string().describe('User wallet address'), limit: z.number().default(20).describe('Max number of fills to return') },
  • Generic HL API helper function used by the handler to fetch user fills data from the /info endpoint.
    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>;
    }
  • TypeScript interface defining the shape of a user fill returned from the HL API (coin, px, sz, side, time, closedPnl, fee).
    interface UserFill {
      coin: string; px: string; sz: string; side: string;
      time: number; closedPnl: string; fee: string;
    }
Behavior2/5

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

No annotations are present, so the description carries full burden. It states 'Get trade history' implying read-only, but does not disclose details such as ordering, pagination, or what constitutes a 'fill'. The behavioral impact is minimally described.

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 a single clear sentence without unnecessary words. It is appropriately sized for a simple tool, though could include more context.

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?

Given the tool has only 2 parameters and no output schema or annotations, the description is adequate but minimal. It lacks details like default behavior for limit or return structure.

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 descriptions for both parameters. The description does not add additional 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 'Get trade history for a user address' uses a specific verb ('Get') and resource ('trade history') with a clear subject ('user address'). It distinguishes itself from siblings like 'get_recent_trades' and 'get_user_positions' by focusing on filled trades for a specific user.

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_recent_trades' or 'get_open_orders'. The description lacks context for selecting this tool.

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