Skip to main content
Glama
kea0811
by kea0811

ig_get_historical_prices

Retrieve historical market price data for specific instruments using the market epic code, time resolution, and date range. Analyze trends and make informed trading decisions with accurate historical insights.

Instructions

Get historical price data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
epicYesMarket epic code
fromNoStart date/time (YYYY-MM-DDTHH:MM:SS)
maxNoMaximum number of data points
resolutionYesTime resolution
toNoEnd date/time (YYYY-MM-DDTHH:MM:SS)

Implementation Reference

  • Core implementation of historical prices fetching via IG API endpoint /prices/{epic} with query parameters for resolution, max, pageSize, from, to.
    async getHistoricalPrices(epic, resolution, options = {}) {
      const {
        max = 10,
        pageSize = 20,
        from,
        to
      } = options;
    
      const params = new URLSearchParams({
        resolution,
        max: max.toString(),
        pageSize: pageSize.toString()
      });
    
      if (from) params.append('from', from);
      if (to) params.append('to', to);
    
      try {
        const response = await this.apiClient.get(`/prices/${epic}?${params}`, 3);
        return response.data;
      } catch (error) {
        logger.error('Failed to get historical prices:', error.message);
        throw error;
      }
    }
  • MCP tool execution handler that extracts arguments and delegates to igService.getHistoricalPrices, formats response as JSON text.
    case 'ig_get_historical_prices':
      const prices = await igService.getHistoricalPrices(
        args.epic,
        args.resolution,
        {
          max: args.max,
          from: args.from,
          to: args.to,
        }
      );
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(prices, null, 2),
          },
        ],
      };
  • Input schema defining parameters: epic (required), resolution (required, enum), max (default 10), from, to.
    inputSchema: {
      type: 'object',
      properties: {
        epic: {
          type: 'string',
          description: 'Market epic code',
        },
        resolution: {
          type: 'string',
          enum: ['SECOND', 'MINUTE', 'MINUTE_2', 'MINUTE_3', 'MINUTE_5', 'MINUTE_10', 'MINUTE_15', 'MINUTE_30', 'HOUR', 'HOUR_2', 'HOUR_3', 'HOUR_4', 'DAY', 'WEEK', 'MONTH'],
          description: 'Time resolution',
        },
        max: {
          type: 'number',
          description: 'Maximum number of data points',
          default: 10,
        },
        from: {
          type: 'string',
          description: 'Start date/time (YYYY-MM-DDTHH:MM:SS)',
        },
        to: {
          type: 'string',
          description: 'End date/time (YYYY-MM-DDTHH:MM:SS)',
        },
      },
      required: ['epic', 'resolution'],
    },
  • Tool definition in TOOLS array for registration in MCP server's listTools response.
    {
      name: 'ig_get_historical_prices',
      description: 'Get historical price data',
      inputSchema: {
        type: 'object',
        properties: {
          epic: {
            type: 'string',
            description: 'Market epic code',
          },
          resolution: {
            type: 'string',
            enum: ['SECOND', 'MINUTE', 'MINUTE_2', 'MINUTE_3', 'MINUTE_5', 'MINUTE_10', 'MINUTE_15', 'MINUTE_30', 'HOUR', 'HOUR_2', 'HOUR_3', 'HOUR_4', 'DAY', 'WEEK', 'MONTH'],
            description: 'Time resolution',
          },
          max: {
            type: 'number',
            description: 'Maximum number of data points',
            default: 10,
          },
          from: {
            type: 'string',
            description: 'Start date/time (YYYY-MM-DDTHH:MM:SS)',
          },
          to: {
            type: 'string',
            description: 'End date/time (YYYY-MM-DDTHH:MM:SS)',
          },
        },
        required: ['epic', 'resolution'],
      },
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Get historical price data' implies a read-only operation but doesn't specify whether this requires authentication, has rate limits, returns paginated results, or what format the historical data takes. For a financial data tool with zero annotation coverage, this is a significant gap in behavioral context.

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 communicates the core purpose without any wasted words. It's appropriately sized for a straightforward data retrieval tool and is front-loaded with the essential information. Every word earns its place in this minimal description.

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

Completeness2/5

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

Given the complexity of financial data retrieval with 5 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what the returned data looks like, whether authentication is required (though sibling tools suggest it might be), or any limitations on date ranges or data availability. For a tool with this level of complexity and no structured support, the description should provide more context.

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 description coverage is 100%, so the schema already documents all 5 parameters with good descriptions. The tool description adds no additional parameter information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description, which applies here.

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 'Get historical price data' clearly states the verb ('Get') and resource ('historical price data'), making the purpose immediately understandable. However, it doesn't differentiate this tool from potential sibling tools that might also retrieve price data, such as 'ig_get_market_details' which could include current pricing information. The description is specific about what data is retrieved but lacks sibling distinction.

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 sibling tools like 'ig_get_market_details' and 'ig_search_markets' that might provide related market data, there's no indication of when historical price data is needed versus current market details or search results. The description offers no context about appropriate use cases or exclusions.

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/kea0811/ig-trading-mcp'

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