Skip to main content
Glama

Polymarket Thin Book Detection

pm_micro_thin

Detects thin order book markets susceptible to slippage or manipulation. Shows markets below a liquidity threshold with spread metrics.

Instructions

Detect markets with thin order books that may be susceptible to slippage or manipulation. Shows markets below a liquidity threshold with spread metrics. Cost: $0.005 per query. Source: Polymarket order book analysis.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thresholdNoLiquidity threshold in USD (markets below this are flagged)
limitNoMaximum results (default 25)

Implementation Reference

  • Handler function for the pm_micro_thin tool. Calls /api/v1/pm/micro/thin with threshold and limit params, returns API results or error.
    server.registerTool(
      "pm_micro_thin",
      {
        title: "Polymarket Thin Book Detection",
        description:
          "Detect markets with thin order books that may be susceptible to slippage or " +
          "manipulation. Shows markets below a liquidity threshold with spread metrics. " +
          "Cost: $0.005 per query. Source: Polymarket order book analysis.",
        inputSchema: {
          threshold: z
            .number()
            .optional()
            .describe("Liquidity threshold in USD (markets below this are flagged)"),
          limit: z
            .number()
            .int()
            .min(1)
            .max(100)
            .optional()
            .describe("Maximum results (default 25)"),
        },
      },
      async ({ threshold, limit }) => {
        const res = await apiGet<PmMicroQueryResponse>("/api/v1/pm/micro/thin", {
          threshold: threshold ?? 50,
          limit: limit ?? 25,
        });
    
        if (!res.ok) {
          return {
            content: [
              {
                type: "text" as const,
                text: `API error (${res.status}): ${JSON.stringify(res.data)}`,
              },
            ],
            isError: true,
          };
        }
    
        const { count, data } = res.data;
        const warn = stalenessWarning(res);
        const summary = `${warn}Found ${count} thin book market(s).`;
        const json = JSON.stringify(data, null, 2);
    
        return {
          content: [{ type: "text" as const, text: `${summary}\n\n${json}` }],
        };
      },
    );
  • Input schema for pm_micro_thin: optional threshold (number) and limit (int 1-100).
    inputSchema: {
      threshold: z
        .number()
        .optional()
        .describe("Liquidity threshold in USD (markets below this are flagged)"),
      limit: z
        .number()
        .int()
        .min(1)
        .max(100)
        .optional()
        .describe("Maximum results (default 25)"),
    },
  • src/index.ts:58-58 (registration)
    Registration call in the main index.ts that wires up all pm_micro tools including pm_micro_thin.
    registerPmMicroTools(server);
  • The registration function that calls server.registerTool for pm_micro_thin (and other pm_micro tools).
    export function registerPmMicroTools(server: McpServer): void {
  • The apiGet helper used by the handler to make HTTP GET requests to the Verilex API, including staleness detection.
    export async function apiGet<T = unknown>(
      path: string,
      params?: Record<string, string | number | undefined>,
    ): Promise<ApiResponse<T>> {
      const url = buildUrl(path, params);
    
      const headers: Record<string, string> = {
        Accept: "application/json",
        "User-Agent": "verilex-mcp-server/0.1.0",
      };
    
      // Forward x402 payment token if present in env (for paid endpoints)
      const paymentToken = process.env.VERILEX_PAYMENT_TOKEN;
      if (paymentToken) {
        headers["X-Payment-Token"] = paymentToken;
      }
    
      const res = await fetch(url, { headers });
      const data = (await res.json()) as T;
    
      const stale = res.headers.get("X-Data-Stale");
      const lastUpdated = res.headers.get("X-Data-Last-Updated");
      const ageSeconds = res.headers.get("X-Data-Age-Seconds");
    
      return {
        ok: res.ok,
        status: res.status,
        data,
        stale: stale === "true",
        lastUpdated: lastUpdated ?? undefined,
        ageSeconds: ageSeconds ? Number(ageSeconds) : undefined,
      };
    }
  • The stalenessWarning helper used by the handler to append stale data warnings to the output.
    export function stalenessWarning(res: ApiResponse): string {
      if (!res.stale) return "";
      const parts = ["[STALE DATA]"];
      if (res.lastUpdated) parts.push(`Last updated: ${res.lastUpdated}`);
      if (res.ageSeconds != null) parts.push(`Age: ${res.ageSeconds}s`);
      return parts.join(" ") + "\n\n";
    }
Behavior3/5

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

No annotations provided, so description carries burden. It mentions cost ($0.005 per query) and that it 'Shows markets below a liquidity threshold with spread metrics,' implying a read operation. However, it does not detail side effects, rate limits, or how results are returned.

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 efficiently convey purpose, function, cost, and source. No fluff; every sentence adds useful information.

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?

With 2 parameters and no output schema, the description covers the tool's function adequately. It mentions output includes 'spread metrics' and cost. Lacks details on error states or result format, but acceptable for a straightforward 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 coverage is 100% with descriptions for both parameters. Description adds value by mentioning 'spread metrics' and cost, contextualizing the output beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states it 'Detect markets with thin order books' and mentions liquidity threshold and spread metrics. However, it does not explicitly differentiate from sibling tools like pm_micro_depth or pm_micro_stats.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives. Context signals list many similar tools (e.g., pm_micro_depth, pm_micro_stats) but the description provides no comparison or selection criteria.

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/carrierone/verilexdata-mcp'

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