Skip to main content
Glama
kea0811
by kea0811

ig_get_market_details

Retrieve comprehensive market data for specific instruments by inputting market epic codes. Use this to analyze forex, indices, and commodities for informed trading decisions.

Instructions

Get detailed information about a market

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
epicsYesList of market epic codes (max 50)

Implementation Reference

  • Core handler function that fetches market details from IG API for the given list of epics (up to 50), handles array normalization and error logging.
    async getMarketDetails(epics) {
      if (!Array.isArray(epics)) {
        epics = [epics];
      }
    
      if (epics.length > 50) {
        throw new Error('Maximum 50 epics allowed per request');
      }
    
      try {
        const epicString = epics.join(',');
        const response = await this.apiClient.get(`/markets?epics=${encodeURIComponent(epicString)}`);
        return response.data;
      } catch (error) {
        logger.error('Failed to get market details:', error.message);
        throw error;
      }
    }
  • MCP tool execution handler that delegates to IGService.getMarketDetails and formats response as MCP content.
    case 'ig_get_market_details':
      const marketDetails = await igService.getMarketDetails(args.epics);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(marketDetails, null, 2),
          },
        ],
      };
  • Tool schema definition including name, description, and input schema for epics array, used for tool listing and validation.
    {
      name: 'ig_get_market_details',
      description: 'Get detailed information about a market',
      inputSchema: {
        type: 'object',
        properties: {
          epics: {
            type: 'array',
            items: {
              type: 'string',
            },
            description: 'List of market epic codes (max 50)',
          },
        },
        required: ['epics'],
      },
    },
  • Registers the list tools handler that returns the TOOLS array containing the ig_get_market_details tool definition.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: 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