ig_get_client_sentiment
Analyzes client sentiment for specific markets using market IDs to inform trading decisions, integrated with the IG Trading API for forex, indices, and commodities.
Instructions
Get client sentiment for markets
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| marketIds | Yes | List of market IDs |
Implementation Reference
- src/services/ig-service.js:398-411 (handler)Core implementation of the tool: fetches client sentiment data from IG API endpoint /clientsentiment using the provided marketIds.async getClientSentiment(marketIds) { if (!Array.isArray(marketIds)) { marketIds = [marketIds]; } try { const marketIdString = marketIds.join(','); const response = await this.apiClient.get(`/clientsentiment?marketIds=${encodeURIComponent(marketIdString)}`); return response.data; } catch (error) { logger.error('Failed to get client sentiment:', error.message); throw error; } }
- src/services/mcp-service.js:721-730 (handler)MCP server handler for the tool: calls igService.getClientSentiment and formats response as MCP content.case 'ig_get_client_sentiment': const sentiment = await igService.getClientSentiment(args.marketIds); return { content: [ { type: 'text', text: JSON.stringify(sentiment, null, 2), }, ], };
- src/services/mcp-service.js:422-438 (schema)Tool schema definition including input validation for marketIds array.{ name: 'ig_get_client_sentiment', description: 'Get client sentiment for markets', inputSchema: { type: 'object', properties: { marketIds: { type: 'array', items: { type: 'string', }, description: 'List of market IDs', }, }, required: ['marketIds'], }, },
- src/services/mcp-service.js:506-510 (registration)Registration of tool list handler which returns the TOOLS array containing 'ig_get_client_sentiment'.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: TOOLS, }; });