Skip to main content
Glama
imbenrabi

Financial Modeling Prep MCP Server

getDEMA

Read-onlyIdempotent

Calculate the Double Exponential Moving Average (DEMA) for a stock to analyze trends and identify potential buy or sell signals using historical price data.

Instructions

Calculate the Double Exponential Moving Average (DEMA) for a stock using the FMP DEMA API. This tool helps users analyze trends and identify potential buy or sell signals based on historical price data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesStock symbol
periodLengthYesPeriod length for the indicator
timeframeYesTimeframe (1min, 5min, 15min, 30min, 1hour, 4hour, 1day)
from_dateNoStart date (YYYY-MM-DD)
toNoEnd date (YYYY-MM-DD)

Implementation Reference

  • The MCP tool registration and handler for 'getDEMA'. It registers the tool with a Zod schema for input validation (symbol, periodLength, timeframe, optional from_date and to), and the async handler calls technicalIndicatorsClient.getDEMA() then returns the result as JSON.
    server.tool(
      "getDEMA",
      "Calculate the Double Exponential Moving Average (DEMA) for a stock using the FMP DEMA API. This tool helps users analyze trends and identify potential buy or sell signals based on historical price data.",
      {
        symbol: z.string().describe("Stock symbol"),
        periodLength: z.number().describe("Period length for the indicator"),
        timeframe: z
          .string()
          .describe("Timeframe (1min, 5min, 15min, 30min, 1hour, 4hour, 1day)"),
        from_date: z.string().optional().describe("Start date (YYYY-MM-DD)"),
        to: z.string().optional().describe("End date (YYYY-MM-DD)"),
      },
      async ({ symbol, periodLength, timeframe, from_date: from, to }) => {
        try {
          const results = await technicalIndicatorsClient.getDEMA({
            symbol,
            periodLength,
            timeframe,
            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 DEMAIndicator interface extending TechnicalIndicatorBase, defining the shape of the DEMA API response with an additional 'dema' field.
    // Double Exponential Moving Average (DEMA)
    export interface DEMAIndicator extends TechnicalIndicatorBase {
      dema: number;
    }
  • The TechnicalIndicatorParams interface used as input parameters for the getDEMA request.
    export interface TechnicalIndicatorParams {
      symbol: string;
      periodLength: number;
      timeframe: string;
      from?: string;
      to?: string;
    }
  • The TechnicalIndicatorsClient.getDEMA() method that makes the actual API call to /technical-indicators/dema endpoint via the base FMPClient.
    /**
     * Get Double Exponential Moving Average (DEMA) indicator
     * @param params Technical indicator parameters
     * @param options Optional parameters including abort signal and context
     */
    async getDEMA(
      params: TechnicalIndicatorParams,
      options?: {
        signal?: AbortSignal;
        context?: FMPContext;
      }
    ): Promise<DEMAIndicator[]> {
      return super.get<DEMAIndicator[]>(
        "/technical-indicators/dema",
        params,
        options
      );
    }
  • The registerTechnicalIndicatorsTools function that creates the TechnicalIndicatorsClient instance (which the getDEMA handler uses). This is the registration entry point for all technical indicator tools.
    export function registerTechnicalIndicatorsTools(
      server: McpServer,
      accessToken?: string
    ): void {
      const technicalIndicatorsClient = new TechnicalIndicatorsClient(accessToken);
Behavior3/5

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

Annotations already indicate read-only and idempotent behavior. The description adds that it uses historical price data and helps generate signals, which provides some context but does not cover rate limits, error handling, or data sources beyond what is implicit.

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 concise sentences that front-load the action and purpose. No unnecessary words.

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 is minimal but covers the basic function. Given the presence of many sibling indicators, more differentiation would help, but it is not critically incomplete. No output schema exists, so return value explanation is optional.

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?

Schema coverage is 100% with each parameter having a description. The description does not add further semantics or constraints beyond the schema, so a baseline 3 is appropriate.

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 calculates DEMA for a stock and mentions its use for trend analysis and buy/sell signals. It differentiates from siblings by naming the specific indicator (DEMA), but does not explicitly contrast with similar tools like getEMA or getSMA.

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 is provided on when to use DEMA vs alternatives such as EMA, SMA, or TEMA. There are no usage scenarios, exclusions, or prerequisites mentioned.

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