Skip to main content
Glama
imbenrabi

Financial Modeling Prep MCP Server

getCOTAnalysis

Read-onlyIdempotent

Analyze Commitment of Traders (COT) reports for a commodity and date range to evaluate market sentiment, dynamics, and potential reversals.

Instructions

Gain in-depth insights into market sentiment with the FMP COT Report Analysis API. Analyze the Commitment of Traders (COT) reports for a specific date range to evaluate market dynamics, sentiment, and potential reversals across various sectors.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesCommodity symbol
from_dateNoOptional start date (YYYY-MM-DD)
toNoOptional end date (YYYY-MM-DD)

Implementation Reference

  • The tool handler for 'getCOTAnalysis'. Registers the tool with schema (symbol, from_date, to) and implements the async handler that calls cotClient.getAnalysis().
    server.tool(
      "getCOTAnalysis",
      "Gain in-depth insights into market sentiment with the FMP COT Report Analysis API. Analyze the Commitment of Traders (COT) reports for a specific date range to evaluate market dynamics, sentiment, and potential reversals across various sectors.",
      {
        symbol: z.string().describe("Commodity symbol"),
        from_date: z
          .string()
          .optional()
          .describe("Optional start date (YYYY-MM-DD)"),
        to: z
          .string()
          .optional()
          .describe("Optional end date (YYYY-MM-DD)"),
      },
      async ({ symbol, from_date: from, to }) => {
        try {
          const results = await cotClient.getAnalysis(symbol, from, to);
          return {
            content: [{ type: "text", text: JSON.stringify(results, null, 2) }],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error: ${
                  error instanceof Error ? error.message : String(error)
                }`,
              },
            ],
            isError: true,
          };
        }
      }
  • The COTClient.getAnalysis() method that calls the FMP API endpoint '/commitment-of-traders-analysis' with symbol, from, to parameters.
    async getAnalysis(
      symbol: string,
      from?: string,
      to?: string,
      options?: {
        signal?: AbortSignal;
        context?: FMPContext;
      }
    ): Promise<COTAnalysis[]> {
      return super.get<COTAnalysis[]>(
        "/commitment-of-traders-analysis",
        { symbol, from, to },
        options
      );
    }
  • The COTAnalysis interface defining the return type from getAnalysis(). Contains fields: symbol, date, name, sector, exchange, long/short market situation, net position, market sentiment, and reversal trend.
    export interface COTAnalysis {
      symbol: string;
      date: string;
      name: string;
      sector: string;
      exchange: string;
      currentLongMarketSituation: number;
      currentShortMarketSituation: number;  
      marketSituation: string;
      previousLongMarketSituation: number;
      previousShortMarketSituation: number;
      previousMarketSituation: string;
      netPostion: number;
      previousNetPosition: number;  
      changeInNetPosition: number;
      marketSentiment: string;
      reversalTrend: boolean;
    }
  • Registration of the cot module (which includes getCOTAnalysis) via createModuleAdapter('cot', registerCOTTools) in the CORE_MODULE_ADAPTERS registry.
    export const CORE_MODULE_ADAPTERS: Record<string, ModuleLoader> = {
      search: createModuleAdapter('search', registerSearchTools),
      directory: createModuleAdapter('directory', registerDirectoryTools),
      analyst: createModuleAdapter('analyst', registerAnalystTools),
      calendar: createModuleAdapter('calendar', registerCalendarTools),
      chart: createModuleAdapter('chart', registerChartTools),
      company: createModuleAdapter('company', registerCompanyTools),
      cot: createModuleAdapter('cot', registerCOTTools),
      esg: createModuleAdapter('esg', registerESGTools),
      economics: createModuleAdapter('economics', registerEconomicsTools),
      dcf: createModuleAdapter('dcf', registerDCFTools),
    };
  • The registerCOTTools function that registers all COT-related tools on the MCP server, including getCOTAnalysis (line 50).
    export function registerCOTTools(server: McpServer, accessToken?: string): void {
      const cotClient = new COTClient(accessToken);
    
      server.tool(
        "getCOTReports",
        "Access comprehensive Commitment of Traders (COT) reports with the FMP COT Report API. This API provides detailed information about long and short positions across various sectors, helping you assess market sentiment and track positions in commodities, indices, and financial instruments.",
        {
          symbol: z.string().describe("Commodity symbol"),
          from_date: z
            .string()
            .optional()
            .describe("Optional start date (YYYY-MM-DD)"),
          to: z
            .string()
            .optional()
            .describe("Optional end date (YYYY-MM-DD)"),
        },
        async ({ symbol, from_date: from, to }) => {
          try {
            const results = await cotClient.getReports(symbol, from, to);
            return {
              content: [{ type: "text", text: JSON.stringify(results, null, 2) }],
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text",
                  text: `Error: ${
                    error instanceof Error ? error.message : String(error)
                  }`,
                },
              ],
              isError: true,
            };
          }
        }
      );
    
      server.tool(
        "getCOTAnalysis",
        "Gain in-depth insights into market sentiment with the FMP COT Report Analysis API. Analyze the Commitment of Traders (COT) reports for a specific date range to evaluate market dynamics, sentiment, and potential reversals across various sectors.",
        {
          symbol: z.string().describe("Commodity symbol"),
          from_date: z
            .string()
            .optional()
            .describe("Optional start date (YYYY-MM-DD)"),
          to: z
            .string()
            .optional()
            .describe("Optional end date (YYYY-MM-DD)"),
        },
        async ({ symbol, from_date: from, to }) => {
          try {
            const results = await cotClient.getAnalysis(symbol, from, to);
            return {
              content: [{ type: "text", text: JSON.stringify(results, null, 2) }],
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text",
                  text: `Error: ${
                    error instanceof Error ? error.message : String(error)
                  }`,
                },
              ],
              isError: true,
            };
          }
        }
      );
    
      server.tool("getCOTList",
        "Access a comprehensive list of available Commitment of Traders (COT) reports by commodity or futures contract using the FMP COT Report List API. This API provides an overview of different market segments, allowing users to retrieve and explore COT reports for a wide variety of commodities and financial instruments.",
        {},
        async () => {
          try {
            const results = await cotClient.getList();
            return {
              content: [{ type: "text", text: JSON.stringify(results, null, 2) }],
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text",
                  text: `Error: ${
                    error instanceof Error ? error.message : String(error)
                  }`,
                },
              ],
              isError: true,
            };
          }
      });
    }
Behavior3/5

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

Annotations already indicate readOnlyHint=true, idempotentHint=true, and openWorldHint=true. The description adds that the tool evaluates market dynamics and potential reversals, which is helpful but does not disclose additional behavioral traits beyond the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that front-loads the purpose. It is relatively efficient, though it could be slightly more structured for clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description explains what the tool does but does not mention what the output contains (e.g., numeric indicators, text summaries). Since there is no output schema, the description should provide some indication of return values. This gap reduces completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema covers all parameters with descriptions (100% coverage). The description mentions 'specific date range' aligning with from_date and to, but adds no significant extra meaning beyond what the schema already provides.

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?

The description clearly states the tool's purpose: analyzing Commitment of Traders (COT) reports for market sentiment and potential reversals. However, it does not differentiate from sibling tools like getCOTReports or getCOTList, which are related but likely serve different functions (e.g., raw data vs. analysis).

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

Usage Guidelines3/5

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

The description implies use for gaining in-depth market sentiment insights but does not explicitly state when to use this tool, when not to, or suggest alternatives. It provides context but lacks explicit guidance.

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/imbenrabi/Financial-Modeling-Prep-MCP-Server'

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