Skip to main content
Glama
matteoantoci

Marketstack MCP Server

by matteoantoci

get_intraday_data

Retrieve intraday stock data for specific tickers with customizable filters like intervals, exchanges, and date ranges. Supports up to 100 symbols and includes pre/post market data.

Instructions

Obtain intraday data for one or multiple stock tickers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
after_hoursNoIf set to true, includes pre and post market data if available. By default is set to false.
date_fromNoFilter results based on a specific timeframe by passing a from-date in `YYYY-MM-DD` format. You can also specify an exact time in ISO-8601 date format, e.g. `2020-05-21T00:00:00+0000`.
date_toNoFilter results based on a specific timeframe by passing an end-date in `YYYY-MM-DD` format. You can also specify an exact time in ISO-8601 date format, e.g. `2020-05-21T00:00:00+0000`.
exchangeNoFilter your results based on a specific stock exchange by specifying the MIC identification of a stock exchange. Example: `IEXG`
intervalNoSpecify your preferred data interval. Available values: `1min`, `5min`, `10min`, `15min`, `30min`, `1hour` (Default), `3hour`, `6hour`, `12hour` and `24hour`.1hour
limitNoSpecify a pagination limit (number of results per page) for your API request. Default limit value is `100`, maximum allowed limit value is `1000`.
offsetNoSpecify a pagination offset value for your API request. Example: An offset value of `100` combined with a limit value of 10 would show results 100-110. Default value is `0`, starting with the first available result.
sortNoBy default, results are sorted by date/time descending. Use this parameter to specify a sorting order. Available values: `DESC` (Default), `ASC`.DESC
symbolsYesSpecify one or multiple comma-separated stock symbols (tickers) for your request, e.g. `AAPL` or `AAPL,MSFT`. Each symbol consumes one API request. Maximum: 100 symbols

Implementation Reference

  • The main handler function that destructures the input, constructs API parameters for the 'intraday' endpoint, fetches data from MarketstackClient, and handles errors.
    const getIntradayDataHandler = async (input: Input, client: MarketstackClient): Promise<Output> => {
      try {
        const { symbols, exchange, interval, sort, date_from, date_to, limit, offset, after_hours } = input;
    
        const apiRequestParams: MarketstackApiParams = {
          endpoint: 'intraday',
          symbols,
          ...(exchange && { exchange }), // Include if exchange is provided
          ...(interval && { interval }), // Include if interval is provided
          ...(sort && { sort }), // Include if sort is provided
          ...(date_from && { date_from }), // Include if date_from is provided
          ...(date_to && { date_to }), // Include if date_to is provided
          ...(limit && { limit }), // Include if limit is provided
          ...(offset && { offset }), // Include if offset is provided
          ...(after_hours && { after_hours }), // Include if after_hours is true
        };
    
        const data = await client.fetchApiData(apiRequestParams);
    
        return data;
      } catch (error: unknown) {
        console.error('getIntradayData tool error:', error);
        const message = error instanceof Error ? error.message : 'An unknown error occurred.';
        throw new Error(`getIntradayData tool failed: ${message}`);
      }
    };
  • Zod input schema shape defining parameters like symbols, exchange, interval, dates, pagination, and after_hours for the intraday data tool.
    const getIntradayDataInputSchemaShape = {
      symbols: z
        .string()
        .describe(
          'Specify one or multiple comma-separated stock symbols (tickers) for your request, e.g. `AAPL` or `AAPL,MSFT`. Each symbol consumes one API request. Maximum: 100 symbols'
        ),
      exchange: z
        .string()
        .optional()
        .describe(
          'Filter your results based on a specific stock exchange by specifying the MIC identification of a stock exchange. Example: `IEXG`'
        ),
      interval: z
        .enum(['1min', '5min', '10min', '15min', '30min', '1hour', '3hour', '6hour', '12hour', '24hour'])
        .optional()
        .default('1hour')
        .describe(
          'Specify your preferred data interval. Available values: `1min`, `5min`, `10min`, `15min`, `30min`, `1hour` (Default), `3hour`, `6hour`, `12hour` and `24hour`.'
        ),
      sort: z
        .enum(['DESC', 'ASC'])
        .optional()
        .default('DESC')
        .describe(
          'By default, results are sorted by date/time descending. Use this parameter to specify a sorting order. Available values: `DESC` (Default), `ASC`.'
        ),
      date_from: z
        .string()
        .optional()
        .describe(
          'Filter results based on a specific timeframe by passing a from-date in `YYYY-MM-DD` format. You can also specify an exact time in ISO-8601 date format, e.g. `2020-05-21T00:00:00+0000`.'
        ),
      date_to: z
        .string()
        .optional()
        .describe(
          'Filter results based on a specific timeframe by passing an end-date in `YYYY-MM-DD` format. You can also specify an exact time in ISO-8601 date format, e.g. `2020-05-21T00:00:00+0000`.'
        ),
      limit: z
        .number()
        .int()
        .min(1)
        .max(1000)
        .optional()
        .default(100)
        .describe(
          'Specify a pagination limit (number of results per page) for your API request. Default limit value is `100`, maximum allowed limit value is `1000`.'
        ),
      offset: z
        .number()
        .int()
        .min(0)
        .optional()
        .default(0)
        .describe(
          'Specify a pagination offset value for your API request. Example: An offset value of `100` combined with a limit value of 10 would show results 100-110. Default value is `0`, starting with the first available result.'
        ),
      after_hours: z
        .boolean()
        .optional()
        .default(false)
        .describe('If set to true, includes pre and post market data if available. By default is set to false.'),
      // Note: The documentation also mentions /intraday/[date] and /intraday/latest, but the parameters section
      // seems to describe the /intraday endpoint with query parameters. We'll implement the query parameter
      // approach for now as it's more flexible for date ranges.
    };
  • Registers the get_intraday_data tool with the MCP server using server.tool(), wrapping the handler with wrapToolHandler.
    server.tool(
      getIntradayDataTool.name,
      getIntradayDataTool.description,
      getIntradayDataTool.inputSchemaShape,
      wrapToolHandler((input) => getIntradayDataTool.handler(input, client))
    );
  • Exports the tool definition object including name, description, schema, and handler reference.
    export const getIntradayDataTool: MarketstackToolDefinition = {
      name: 'get_intraday_data',
      description: 'Obtain intraday data for one or multiple stock tickers.',
      inputSchemaShape: getIntradayDataInputSchemaShape,
      handler: getIntradayDataHandler,
    };
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions obtaining data but doesn't cover important aspects like rate limits, authentication requirements, data freshness, error conditions, or what format the data returns. For a data retrieval tool with 9 parameters, this leaves significant behavioral gaps.

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?

The description is a single, efficient sentence that immediately conveys the core functionality without any wasted words. It's appropriately sized for a tool with comprehensive schema documentation and gets straight to the point.

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?

For a data retrieval tool with 9 parameters and 100% schema coverage but no output schema, the description is minimally adequate. It states what the tool does but lacks important context about return format, data structure, error handling, and usage boundaries that would help an agent use it effectively.

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 schema description coverage is 100%, meaning all parameters are well-documented in the schema itself. The description doesn't add any parameter-specific information beyond what's already in the schema descriptions, so it meets the baseline expectation but doesn't provide additional value.

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 action ('obtain') and resource ('intraday data for one or multiple stock tickers'), making the purpose immediately understandable. It distinguishes from siblings like 'get_end_of_day_data' by specifying intraday data, but doesn't explicitly contrast with all siblings like 'get_ticker_details' or 'get_ticker_info'.

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?

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools for financial data (e.g., get_end_of_day_data, get_ticker_details, get_dividends_data), there's no indication of when intraday data is appropriate versus other data types or when to choose between similar tools.

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

Related 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/matteoantoci/mcp-marketstack'

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