Skip to main content
Glama
PaulieB14

Limitless MCP

get_liquidity_events

Retrieve liquidity lifecycle events including splits, merges, and redemptions. Filter results by market or user address to track liquidity changes.

Instructions

Get splits, merges, and redemptions — the liquidity lifecycle events. Filter by market or user address.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conditionIdNoFilter by market conditionId
addressNoFilter by user address
firstNo

Implementation Reference

  • The handler function for get_liquidity_events which queries subgraphs, merges data, and hydrates names.
    async ({ conditionId, address, first }) => {
      try {
        const condFilter = conditionId ? `conditionId: "${conditionId}"` : "";
        const addrFilter = address ? `stakeholder: "${address.toLowerCase()}"` : "";
        const redAddrFilter = address ? `redeemer: "${address.toLowerCase()}"` : "";
        const where = [condFilter, addrFilter].filter(Boolean).join(", ");
        const redWhere = [condFilter, redAddrFilter].filter(Boolean).join(", ");
    
        const eventQuery = `{
          splits(first: ${first}, orderBy: timestamp, orderDirection: desc${where ? `, where: { ${where} }` : ""}) {
            id stakeholder { id } conditionId amount amountUSD timestamp txHash
          }
          merges(first: ${first}, orderBy: timestamp, orderDirection: desc${where ? `, where: { ${where} }` : ""}) {
            id stakeholder { id } conditionId amount amountUSD timestamp txHash
          }
          redemptions(first: ${first}, orderBy: timestamp, orderDirection: desc${redWhere ? `, where: { ${redWhere} }` : ""}) {
            id redeemer { id } conditionId payout payoutUSD timestamp txHash
          }
        }`;
    
        const { simple, negrisk } = await queryBoth(eventQuery, eventQuery);
    
        // Merge all events into a unified feed
        const events: any[] = [];
        for (const s of [...(simple.splits || []), ...(negrisk.splits || [])]) {
          events.push({ type: "SPLIT", user: s.stakeholder?.id, conditionId: s.conditionId, amountUSD: s.amountUSD, timestamp: s.timestamp, txHash: s.txHash });
        }
        for (const m of [...(simple.merges || []), ...(negrisk.merges || [])]) {
          events.push({ type: "MERGE", user: m.stakeholder?.id, conditionId: m.conditionId, amountUSD: m.amountUSD, timestamp: m.timestamp, txHash: m.txHash });
        }
        for (const r of [...(simple.redemptions || []), ...(negrisk.redemptions || [])]) {
          events.push({ type: "REDEMPTION", user: r.redeemer?.id, conditionId: r.conditionId, amountUSD: r.payoutUSD, timestamp: r.timestamp, txHash: r.txHash });
        }
    
        events.sort((a, b) => Number(b.timestamp) - Number(a.timestamp));
        const top = events.slice(0, first);
    
        // Hydrate names
        const cids = [...new Set(top.map((e) => e.conditionId).filter(Boolean))];
        const names = new Map<string, string>();
        await Promise.all(cids.map(async (id) => names.set(id, await hydrateName(id))));
        const enriched = top.map((e) => ({
          ...e,
          marketName: names.get(e.conditionId) || e.conditionId,
        }));
    
        return textResult({ eventCount: enriched.length, events: enriched });
      } catch (e) {
        return errorResult(e);
      }
  • Registration of the get_liquidity_events tool in the MCP server.
    server.registerTool(
      "get_liquidity_events",
      {
        description:
          "Get splits, merges, and redemptions — the liquidity lifecycle events. Filter by market or user address.",
        inputSchema: {
          conditionId: z.string().optional().describe("Filter by market conditionId"),
          address: z.string().optional().describe("Filter by user address"),
          first: z.number().default(20),
        },
      },

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/PaulieB14/limitless-subgraphs'

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