Skip to main content
Glama
Liquidiction

Liquidiction

list_markets

List all prediction markets with their current prices on Hyperliquid.

Instructions

List all prediction markets with current prices

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_markets' tool. It fetches outcome metadata (questions + outcomes) and all mid prices from the Hyperliquid API, groups outcomes by their parent question, and returns a formatted text listing all prediction markets with current prices for each side.
    // --- list_markets ---
    server.tool(
      'list_markets',
      'List all prediction markets with current prices',
      {},
      async () => {
        const [meta, mids] = await Promise.all([
          hlInfo<OutcomeMeta>({ type: 'outcomeMeta' }),
          hlInfo<Record<string, string>>({ type: 'allMids' }),
        ]);
    
        const questionMap = new Map<number, QuestionRaw>();
        for (const q of meta.questions) {
          questionMap.set(q.question, q);
        }
    
        const lines: string[] = [];
        // Group outcomes by question
        const grouped = new Map<number | null, OutcomeRaw[]>();
        for (const o of meta.outcomes) {
          const qId = [...questionMap.entries()].find(([, q]) =>
            q.namedOutcomes.includes(o.outcome)
          )?.[0] ?? null;
          if (!grouped.has(qId)) grouped.set(qId, []);
          grouped.get(qId)!.push(o);
        }
    
        for (const [qId, outcomes] of grouped) {
          const q = qId !== null ? questionMap.get(qId) : null;
          if (q) lines.push(`\n## ${q.name}`);
    
          for (const o of outcomes) {
            const sides = o.sideSpecs.map((s, i) => {
              const coin = outcomeToCoin(o.outcome, i);
              const mid = mids[coin] ? (parseFloat(mids[coin]) * 100).toFixed(1) + '%' : '?';
              return `${s.name}: ${mid}`;
            });
            const label = q ? `  [${o.outcome}] ${o.name}` : `\n[${o.outcome}] ${o.name}`;
            lines.push(`${label} — ${sides.join(' | ')}`);
          }
        }
    
        return { content: [{ type: 'text', text: lines.join('\n') }] };
      },
    );
  • mcp-server.ts:82-83 (registration)
    Registration of the 'list_markets' tool using the MCP server.tool() method with an empty schema (no input parameters).
    server.tool(
      'list_markets',
  • Helper function outcomeToCoin, used to convert an outcome ID and side index into a coin identifier string (e.g., '#90') for fetching mid prices from the API.
    function outcomeToCoin(outcomeId: number, side: number): string {
      return `#${10 * outcomeId + side}`;
    }
  • Type definitions for OutcomeRaw, QuestionRaw, and OutcomeMeta, which define the shape of data used by the list_markets handler to structure markets and questions.
    interface OutcomeRaw {
      outcome: number;
      name: string;
      description: string;
      sideSpecs: { name: string }[];
    }
    interface QuestionRaw {
      question: number;
      name: string;
      description: string;
      fallbackOutcome: number;
      namedOutcomes: number[];
      settledNamedOutcomes: number[];
    }
    interface OutcomeMeta { outcomes: OutcomeRaw[]; questions: QuestionRaw[] }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of disclosing behavioral traits. It does not mention whether the operation is read-only, rate limits, data freshness, or any side effects. It only states the basic function.

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, clear sentence with no wasted words. It is front-loaded and efficient.

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?

For a simple tool with no parameters and no output schema, the description provides the essential information. It could mention the return structure, but the current phrasing is sufficient to understand the tool's purpose.

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?

The input schema has zero parameters, so the description does not need to add parameter semantics. The baseline score for 0 parameters is 4, and the description is adequate.

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 action ('list'), the resource ('all prediction markets'), and what is included ('current prices'). It distinguishes from sibling tools like get_market_detail (focused on one market) and get_prices (likely price-specific).

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?

The description implicitly indicates when to use this tool: when one needs an overview of all markets with their current prices. However, it lacks explicit guidance on when not to use it or alternatives, though the context of sibling tools provides some 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/Liquidiction/liquidiction-mcp'

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