ig_get_account_activity
Retrieve account activity history within specified dates for IG Trading accounts. Use filters for detailed data, pagination, and date range to analyze transactions and monitor trading activity.
Instructions
Get account activity history
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| detailed | No | Include detailed information | |
| from | No | Start date (YYYY-MM-DD) | |
| pageSize | No | Number of results per page | |
| to | No | End date (YYYY-MM-DD) |
Input Schema (JSON Schema)
{
"properties": {
"detailed": {
"default": false,
"description": "Include detailed information",
"type": "boolean"
},
"from": {
"description": "Start date (YYYY-MM-DD)",
"type": "string"
},
"pageSize": {
"default": 500,
"description": "Number of results per page",
"type": "number"
},
"to": {
"description": "End date (YYYY-MM-DD)",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/services/ig-service.js:96-121 (handler)The core handler function in IGService that constructs query parameters from input and makes an authenticated API call to retrieve account activity history from the IG REST API endpoint `/history/activity`.async getAccountActivity(options = {}) { const { from = '1990-01-01', to = '2099-01-01', detailed = false, dealId = null, pageSize = 500 } = options; const params = new URLSearchParams({ from, to, detailed: detailed.toString(), pageSize: pageSize.toString() }); if (dealId) params.append('dealId', dealId); try { const response = await this.apiClient.get(`/history/activity?${params}`, 3); return response.data; } catch (error) { logger.error('Failed to get account activity:', error.message); throw error; } }
- src/services/mcp-service.js:114-140 (schema)Tool schema definition including name, description, and input schema for validation in the MCP tool list.{ name: 'ig_get_account_activity', description: 'Get account activity history', inputSchema: { type: 'object', properties: { from: { type: 'string', description: 'Start date (YYYY-MM-DD)', }, to: { type: 'string', description: 'End date (YYYY-MM-DD)', }, detailed: { type: 'boolean', description: 'Include detailed information', default: false, }, pageSize: { type: 'number', description: 'Number of results per page', default: 500, }, }, }, },
- src/services/mcp-service.js:578-587 (handler)MCP server handler case that receives tool call parameters, invokes the IGService method, and formats the response as MCP content.case 'ig_get_account_activity': const activity = await igService.getAccountActivity(args); return { content: [ { type: 'text', text: JSON.stringify(activity, null, 2), }, ], };
- src/services/mcp-service.js:506-510 (registration)Registration of the tool list handler that exposes all tools including 'ig_get_account_activity' via the TOOLS array.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: TOOLS, }; });