getCOTList
Retrieve a comprehensive list of available Commitment of Traders (COT) reports for commodities and futures contracts. Access data on market segments to analyze trader positions and market trends.
Instructions
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.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/cot.ts:85-107 (handler)The main handler for the 'getCOTList' tool. Registers the tool with the MCP server, takes no parameters, calls COTClient.getList() and returns the results as a JSON string.
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, }; } }); - src/api/cot/COTClient.ts:56-61 (helper)The helper method COTClient.getList() that makes the actual API call to /commitment-of-traders-list endpoint to fetch the list of available COT reports.
async getList(options?: { signal?: AbortSignal; context?: FMPContext; }): Promise<COTList[]> { return super.get<COTList[]>("/commitment-of-traders-list", {}, options); } - src/api/cot/types.ts:151-154 (schema)The COTList interface defining the return type with symbol and name fields.
export interface COTList { symbol: string; name: string; } - src/tools/cot.ts:10-108 (registration)The registerCOTTools function that registers all COT tools (getCOTReports, getCOTAnalysis, getCOTList) with the MCP server.
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, }; } }); }