Skip to main content
Glama
jackdark425

Financial Modeling Prep (FMP) MCP Server

by jackdark425

get_insider_trading

Retrieve recent insider trading transactions for a specific stock to monitor corporate insider activity and identify potential market signals.

Instructions

Get recent insider trading activity for a stock

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesStock ticker symbol
limitNoNumber of transactions to return (default: 100)

Implementation Reference

  • The handler for 'get_insider_trading' fetches insider trading data from the FMP API.
    server.registerTool(
      'get_insider_trading',
      {
        description: 'Get recent insider trading activity for a stock',
        inputSchema: InsiderTradingSchema,
      },
      async (args: z.infer<typeof InsiderTradingSchema>) => {
        try {
          const limit = args.limit || 100;
          const data = await fetchFMP<InsiderTrading[]>(
            `/insider-trading/search?symbol=${args.symbol.toUpperCase()}&limit=${limit}`
          );
          return jsonResponse(data);
        } catch (error) {
          return errorResponse(error);
        }
      }
    );
  • Zod schema for validating 'get_insider_trading' inputs.
    const InsiderTradingSchema = z.object({
      symbol: SymbolSchema.describe('Stock ticker symbol'),
      limit: LimitSchema.describe('Number of transactions to return (default: 100)'),
    });
  • Tool registration within the 'registerAnalysisTools' function.
    export function registerAnalysisTools(server: any) {
      // Analyst Estimates
      server.registerTool(
        'get_analyst_estimates',
        {
          description: 'Get analyst financial estimates for a stock (revenue, EPS forecasts)',
          inputSchema: AnalystEstimatesSchema,
        },
        async (args: z.infer<typeof AnalystEstimatesSchema>) => {
          try {
            const period = args.period || 'annual';
            const limit = args.limit || 10;
            const data = await fetchFMP<AnalystEstimate[]>(
              `/analyst-estimates?symbol=${args.symbol.toUpperCase()}&period=${period}&limit=${limit}`
            );
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    
      // Price Target
      server.registerTool(
        'get_price_target',
        {
          description: 'Get analyst price target summary for a stock',
          inputSchema: SymbolOnlySchema,
        },
        async (args: z.infer<typeof SymbolOnlySchema>) => {
          try {
            const data = await fetchFMP<PriceTarget[]>(`/price-target-summary?symbol=${args.symbol.toUpperCase()}`);
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    
      // Analyst Ratings
      server.registerTool(
        'get_analyst_ratings',
        {
          description: 'Get analyst ratings and upgrades/downgrades for a stock',
          inputSchema: SymbolOnlySchema,
        },
        async (args: z.infer<typeof SymbolOnlySchema>) => {
          try {
            const data = await fetchFMP<AnalystRating[]>(`/grades?symbol=${args.symbol.toUpperCase()}`);
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    
      // Insider Trading
      server.registerTool(
        'get_insider_trading',
        {
          description: 'Get recent insider trading activity for a stock',
          inputSchema: InsiderTradingSchema,
        },
        async (args: z.infer<typeof InsiderTradingSchema>) => {
          try {
            const limit = args.limit || 100;
            const data = await fetchFMP<InsiderTrading[]>(
              `/insider-trading/search?symbol=${args.symbol.toUpperCase()}&limit=${limit}`
            );
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    
      // Institutional Holders
      server.registerTool(
        'get_institutional_holders',
        {
          description: 'Get institutional ownership (13F filings) for a stock',
          inputSchema: InstitutionalHoldersSchema,
        },
        async (args: z.infer<typeof InstitutionalHoldersSchema>) => {
          try {
            const limit = args.limit || 100;
            const data = await fetchFMP<InstitutionalHolder[]>(
              `/institutional-ownership/latest?symbol=${args.symbol.toUpperCase()}&limit=${limit}`
            );
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    }

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/jackdark425/aigroup-fmp-mcp'

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