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
| Name | Required | Description | Default |
|---|---|---|---|
| epics | Yes | List of market epic codes (max 50) |
Input Schema (JSON Schema)
{
"properties": {
"epics": {
"description": "List of market epic codes (max 50)",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"epics"
],
"type": "object"
}
Implementation Reference
- src/services/ig-service.js:353-370 (handler)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; } }
- src/services/mcp-service.js:691-700 (handler)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), }, ], };
- src/services/mcp-service.js:373-389 (schema)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'], }, },
- src/services/mcp-service.js:506-510 (registration)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, }; });