Skip to main content
Glama
PaulieB14

Limitless MCP

get_market_positions

Retrieve top position holders for a specific market to analyze major participants and their profit/loss performance.

Instructions

Get top position holders for a specific market. Shows who holds the biggest positions and their PnL.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conditionIdYesMarket conditionId
firstNo

Implementation Reference

  • Registration and handler implementation for the 'get_market_positions' tool, which queries position data from Simple and NegRisk markets.
    server.registerTool(
      "get_market_positions",
      {
        description:
          "Get top position holders for a specific market. Shows who holds the biggest positions and their PnL.",
        inputSchema: {
          conditionId: z.string().describe("Market conditionId"),
          first: z.number().default(20),
        },
      },
      async ({ conditionId, first }) => {
        try {
          const posQuery = `{
            userPositions(
              where: { condition: "${conditionId}", balance_gt: "0" }
              first: ${first}
              orderBy: balance
              orderDirection: desc
            ) {
              id user { id tradesCount totalVolumeUSD } tokenId balance
              netCostUSD realizedPnlUSD lastUpdated
            }
          }`;
    
          const [simpleData, negriskData, name] = await Promise.all([
            querySimple(posQuery).catch(() => ({ userPositions: [] })),
            queryNegRisk(posQuery).catch(() => ({ userPositions: [] })),
            getMarketName(conditionId),
          ]);
    
          const positions = [
            ...(simpleData.userPositions || []),
            ...(negriskData.userPositions || []),
          ]
            .sort((a, b) => parseInt(b.balance) - parseInt(a.balance))
            .slice(0, first);
    
          return textResult({ market: name, conditionId, positionCount: positions.length, positions });
        } catch (e) {
          return errorResult(e);
        }
      }
    );

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