Skip to main content
Glama
PaulieB14

Limitless MCP

get_market_analytics

Retrieve comprehensive market analytics by conditionId, combining on-chain data like volume and trades with metadata such as title and categories for complete market analysis.

Instructions

Get full analytics for a specific market by conditionId. Combines on-chain data (volume, trades, fees, resolution status) with market metadata (title, description, categories). Queries both subgraphs to find the market.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conditionIdYesThe conditionId (hex) of the market

Implementation Reference

  • The registration and handler implementation for the 'get_market_analytics' tool, which queries market and condition data from subgraphs and fetches metadata to provide a comprehensive market report.
    server.registerTool(
      "get_market_analytics",
      {
        description:
          "Get full analytics for a specific market by conditionId. Combines on-chain data (volume, trades, fees, resolution status) with market metadata (title, description, categories). Queries both subgraphs to find the market.",
        inputSchema: {
          conditionId: z.string().describe("The conditionId (hex) of the market"),
        },
      },
      async ({ conditionId }) => {
        try {
          const marketQuery = (entity: string) => `{
            ${entity}(id: "${conditionId}") {
              id venue tradesCount buysCount sellsCount
              volumeUSD buyVolumeUSD sellVolumeUSD feesUSD
              createdAt createdTx
            }
            condition(id: "${conditionId}") {
              id oracle questionId outcomeSlotCount resolved
              payoutNumerators resolvedAt resolvedTx createdAt
            }
          }`;
    
          const [simpleData, negriskData, meta] = await Promise.all([
            querySimple(marketQuery("market")),
            queryNegRisk(marketQuery("negRiskMarket")),
            getMarketMeta(conditionId),
          ]);
    
          const onChain = simpleData.market || negriskData.negRiskMarket;
          const condition = simpleData.condition || negriskData.condition;
          const marketType = simpleData.market ? "simple" : negriskData.negRiskMarket ? "negrisk" : "unknown";
    
          return textResult({
            title: meta?.title || "Unknown",
            description: meta?.description || "",
            categories: meta?.categories || [],
            slug: meta?.slug || "",
            currentPrices: meta?.prices || [],
            expirationDate: meta?.expirationDate || "",
            tradeType: meta?.tradeType || "",
            marketType,
            onChain: onChain || null,
            condition: condition || null,
          });
        } 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