Skip to main content
Glama
PaulieB14

Limitless MCP

get_conditions

Retrieve prepared on-chain market conditions and filter by resolution status to identify resolved or unresolved markets.

Instructions

Get conditions (markets that have been prepared on-chain) with resolution status. Useful for finding resolved/unresolved markets.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resolvedNoFilter by resolution status
firstNo

Implementation Reference

  • The handler function for the 'get_conditions' tool, which queries a subgraph for conditions and hydrates their names.
      async ({ resolved, first }) => {
        try {
          const resolvedFilter = resolved !== undefined ? `resolved: ${resolved}` : "";
          const condQuery = `{
            conditions(
              first: ${first}
              orderBy: createdAt
              orderDirection: desc
              ${resolvedFilter ? `where: { ${resolvedFilter} }` : ""}
            ) {
              id oracle questionId outcomeSlotCount resolved
              payoutNumerators createdAt resolvedAt
            }
          }`;
    
          const { simple, negrisk } = await queryBoth(condQuery, condQuery);
    
          // Deduplicate by id (same CTF contract, same conditions in both)
          const seen = new Set<string>();
          const conditions: any[] = [];
          for (const c of [...(simple.conditions || []), ...(negrisk.conditions || [])]) {
            if (!seen.has(c.id)) {
              seen.add(c.id);
              conditions.push(c);
            }
          }
    
          conditions.sort((a, b) => Number(b.createdAt) - Number(a.createdAt));
          const top = conditions.slice(0, first);
    
          // Hydrate names
          const names = new Map<string, string>();
          await Promise.all(top.map(async (c: any) => names.set(c.id, await hydrateName(c.id))));
          const enriched = top.map((c: any) => ({ ...c, title: names.get(c.id) }));
    
          return textResult({ count: enriched.length, conditions: enriched });
        } catch (e) {
          return errorResult(e);
        }
      }
    );
  • Tool registration for 'get_conditions' in the MCP server.
    server.registerTool(
      "get_conditions",
      {
        description:
          "Get conditions (markets that have been prepared on-chain) with resolution status. Useful for finding resolved/unresolved markets.",
        inputSchema: {
          resolved: z.boolean().optional().describe("Filter by resolution status"),
          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