Skip to main content
Glama
stockmarketscan

stockmarketscan/mcp-server

Official

get_unusual_options_activity

Read-onlyIdempotent

Identify unusual options contracts with volume-to-open interest ratio above 1.5. Filter by symbol, side, minimum premium, and days to expiration for targeted contract-level insights.

Instructions

Return individual options contracts flagged as unusual (Vol/OI > 1.5). Each row is one contract, not one stock. Use when the user wants contract-level detail. Filter by symbol, side (call/put/both), minimum vol/oi, minimum premium, or max days to expiration. For aggregated stock-level flow use get_options_flow_overview instead. Returns { date, count, contracts: [...] }.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolNoFilter to one symbol
sideNoboth
min_vol_oiNo
min_premium_usdNo
max_dteNo
limitNo

Implementation Reference

  • Handler function that fetches unusual options activity from the API and applies client-side filtering by symbol, side, min vol/oi ratio, min premium, and max days to expiration.
    export async function handleGetUnusualOptionsActivity(
      ctx: McpContext,
      rawArgs: unknown
    ): Promise<unknown> {
      const args = GetUnusualOptionsActivityInputSchema.parse(rawArgs);
      const limit = args.limit ?? 300;
      const side = args.side ?? "both";
      const minVolOi = args.min_vol_oi ?? 1.5;
      const minPremium = args.min_premium_usd ?? 25000;
    
      const raw = await ctx.cache.wrap(`uoa:raw:${limit}`, 120_000, () =>
        ctx.apiClient.get<{ data?: UnusualContract[] }>(`/options-flow/unusual`, { limit })
      );
    
      // Client-side filter
      const toNum = (v: unknown) => {
        if (typeof v === "number") return v;
        if (typeof v === "string") return Number(v.replace(/,/g, "")) || 0;
        return 0;
      };
      const contracts = (raw.data || []).filter((r: UnusualContract) => {
        if (args.symbol && (r.symbol || "").toUpperCase() !== args.symbol.toUpperCase()) return false;
        if (side === "call" && r.symbol_type !== "Call") return false;
        if (side === "put" && r.symbol_type !== "Put") return false;
        if (toNum(r.volume_oi_ratio) < minVolOi) return false;
        const premium = toNum(r.last_price) * toNum(r.volume) * 100;
        if (premium < minPremium) return false;
        if (args.max_dte != null && (r.days_to_expiration || 0) > args.max_dte) return false;
        return true;
      });
    
      return {
        count: contracts.length,
        contracts,
      };
    }
  • Zod schema defining the input parameters: symbol (optional), side (call/put/both), min_vol_oi, min_premium_usd, max_dte, and limit.
    export const GetUnusualOptionsActivityInputSchema = z.object({
      symbol: z.string().regex(symbolRegex).optional().describe("Filter to one symbol"),
      side: z.enum(["call", "put", "both"]).default("both").optional(),
      min_vol_oi: z.number().min(0).default(1.5).optional(),
      min_premium_usd: z.number().min(0).default(25000).optional(),
      max_dte: z.number().int().min(0).optional(),
      limit: z.number().int().min(1).max(1000).default(300).optional(),
    });
  • Tool registration in the optionsFlowTools array with name 'get_unusual_options_activity', description, input schema, and read-only annotations.
        name: "get_unusual_options_activity",
        description:
          "Return individual options contracts flagged as unusual (Vol/OI > 1.5). Each row is one contract, not one stock. Use when the user wants contract-level detail. Filter by symbol, side (call/put/both), minimum vol/oi, minimum premium, or max days to expiration. For aggregated stock-level flow use get_options_flow_overview instead. Returns { date, count, contracts: [...] }.",
        inputSchema: z.toJSONSchema(GetUnusualOptionsActivityInputSchema) as Tool["inputSchema"],
        annotations: READ_ONLY_ANNOTATIONS,
      },
    ];
    
    export async function handleGetOptionsFlowOverview(
  • Handler mapping in src/tools/index.ts that wires the tool name 'get_unusual_options_activity' to the handleGetUnusualOptionsActivity function.
      get_unusual_options_activity: (ctx, args) => handleGetUnusualOptionsActivity(ctx, args),
      get_stock_info: (ctx, args) => handleGetStockInfo(ctx, args),
      get_candles: (ctx, args) => handleGetCandles(ctx, args),
      get_stock_report: (ctx, args) => handleGetStockReport(ctx, args),
      search_setups: (ctx, args) => handleSearchSetups(ctx, args),
      get_market_momentum: (ctx, args) => handleGetMarketMomentum(ctx, args),
      get_trends: (ctx, args) => handleGetTrends(ctx, args),
      get_trend_connections: (ctx, args) => handleGetTrendConnections(ctx, args),
      explain_concept: (ctx, args) => handleExplainConcept(ctx, args),
    };
  • TypeScript interface representing the shape of an unusual options contract returned by the API.
    interface UnusualContract {
      symbol?: string;
      symbol_type?: string;
      volume?: string | number;
      open_interest?: string | number;
      volume_oi_ratio?: string | number;
      last_price?: string | number;
      days_to_expiration?: number;
    }
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, idempotentHint=true, and openWorldHint=true. The description adds context about the response structure ({ date, count, contracts: [...] }) and emphasizes contract-level granularity, enhancing behavioral understanding beyond annotations.

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?

Description is four sentences, no redundant information, starts with the core purpose, and builds logically. Every sentence adds value.

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?

Given no output schema and moderate parameter count, the description adequately covers the tool's purpose, filtering options, and return type. It lacks default values for some parameters but remains sufficient for agent selection.

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 description coverage is only 17% (only 'symbol' parameter described). The description compensates by naming and briefly explaining key parameters: symbol, side (call/put/both), min vol/oi, min premium, and max days to expiration. However, it omits the 'limit' parameter and the default for 'min_vol_oi'.

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?

Description clearly states the tool returns individual options contracts flagged as unusual (Vol/OI > 1.5), with each row representing one contract. It distinguishes itself from the sibling tool get_options_flow_overview, which provides aggregated stock-level data.

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?

Explicit guidelines: 'Use when the user wants contract-level detail' and provides a direct alternative: 'For aggregated stock-level flow use get_options_flow_overview instead.' Also lists applicable filters.

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/stockmarketscan/mcp-server'

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