Skip to main content
Glama
PaulieB14

graph-polymarket-mcp

get_market_info

Retrieve comprehensive Polymarket market data including description, prices, outcomes, and CLOB token IDs by providing a market slug or condition ID.

Instructions

Get detailed Polymarket market info by slug or condition ID. Returns full market metadata from the Gamma API including description, prices, outcomes, and CLOB token IDs. Use the returned conditionId to query get_clob_market for live CLOB data, get_market_open_interest for OI, or get_market_resolution for oracle status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slugNoMarket slug (e.g. 'will-trump-win-2024')
conditionIdNoMarket condition ID (hex string)

Implementation Reference

  • src/index.ts:1017-1046 (registration)
    Tool registration for 'get_market_info' using server.registerTool. Defines the input schema (slug or conditionId) and delegates to getMarketBySlug or getMarketByConditionId.
    // ---------------------------------------------------------------------------
    // Tool 22: get_market_info
    // ---------------------------------------------------------------------------
    server.registerTool(
      "get_market_info",
      {
        description:
          "Get detailed Polymarket market info by slug or condition ID. Returns full market metadata from the Gamma API including description, prices, outcomes, and CLOB token IDs. Use the returned conditionId to query get_clob_market for live CLOB data, get_market_open_interest for OI, or get_market_resolution for oracle status.",
        inputSchema: {
          slug: z.string().optional().describe("Market slug (e.g. 'will-trump-win-2024')"),
          conditionId: z.string().optional().describe("Market condition ID (hex string)"),
        },
      },
      async ({ slug, conditionId }) => {
        try {
          if (!slug && !conditionId) {
            return errorResult("Provide either slug or conditionId");
          }
          const markets = slug
            ? await getMarketBySlug(slug)
            : await getMarketByConditionId(conditionId!);
          if (markets.length === 0) {
            return textResult({ error: "Market not found", slug, conditionId });
          }
          return textResult(markets.length === 1 ? markets[0] : markets);
        } catch (error) {
          return errorResult(error);
        }
      }
    );
  • Handler function for get_market_info. Takes slug or conditionId, validates at least one is provided, then calls getMarketBySlug or getMarketByConditionId from polymarketApi.ts, returning the market data.
      async ({ slug, conditionId }) => {
        try {
          if (!slug && !conditionId) {
            return errorResult("Provide either slug or conditionId");
          }
          const markets = slug
            ? await getMarketBySlug(slug)
            : await getMarketByConditionId(conditionId!);
          if (markets.length === 0) {
            return textResult({ error: "Market not found", slug, conditionId });
          }
          return textResult(markets.length === 1 ? markets[0] : markets);
        } catch (error) {
          return errorResult(error);
        }
      }
    );
  • Input schema for get_market_info. Accepts optional slug (string) and conditionId (string) fields.
      inputSchema: {
        slug: z.string().optional().describe("Market slug (e.g. 'will-trump-win-2024')"),
        conditionId: z.string().optional().describe("Market condition ID (hex string)"),
      },
    },
  • Helper function getMarketBySlug — fetches market data from Gamma API by slug.
    export async function getMarketBySlug(slug: string): Promise<GammaMarket[]> {
      return fetchJson<GammaMarket[]>(`${GAMMA_BASE}/markets?slug=${encodeURIComponent(slug)}`);
    }
    
    export async function getMarketByConditionId(conditionId: string): Promise<GammaMarket[]> {
      return fetchJson<GammaMarket[]>(
        `${GAMMA_BASE}/markets?conditionId=${encodeURIComponent(conditionId)}`
      );
    }
  • Helper function getMarketByConditionId — fetches market data from Gamma API by condition ID.
    export async function getMarketByConditionId(conditionId: string): Promise<GammaMarket[]> {
      return fetchJson<GammaMarket[]>(
        `${GAMMA_BASE}/markets?conditionId=${encodeURIComponent(conditionId)}`
      );
    }
Behavior4/5

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

No annotations, but description clearly indicates a read operation (get, returns). It mentions returning full metadata from Gamma API, no side effects hinted. Could mention idempotency or rate limits, but acceptable.

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?

Two sentences, each packed with useful information. No fluff. Front-loaded with purpose and immediate action.

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?

Without output schema, description sufficiently explains what is returned (full metadata, specific fields). Mentions key uses, making it complete for an API tool.

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?

Schema has 100% coverage with clear descriptions for each parameter. Description adds value by explaining the relationship (conditionId used for other calls) and that either slug or conditionId is sufficient.

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?

States clearly it gets Polymarket market info by slug or condition ID, returns full metadata including description, prices, outcomes, CLOB token IDs. Distinguishes from sibling tools by mentioning conditionId usage for other queries.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly tells when to use (get market metadata) and what not to use for (CLOB data, OI, resolution), providing alternatives like get_clob_market, get_market_open_interest, get_market_resolution.

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/PaulieB14/graph-polymarket-mcp'

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