ig_add_to_watchlist
Add a specific market instrument (epic) to a designated watchlist on IG Trading for easy tracking and analysis. Requires watchlist ID and epic details.
Instructions
Add an epic to a watchlist
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| epic | Yes | Epic to add | |
| watchlistId | Yes | Watchlist ID |
Input Schema (JSON Schema)
{
"properties": {
"epic": {
"description": "Epic to add",
"type": "string"
},
"watchlistId": {
"description": "Watchlist ID",
"type": "string"
}
},
"required": [
"watchlistId",
"epic"
],
"type": "object"
}
Implementation Reference
- src/services/ig-service.js:465-473 (handler)Core handler function that executes the tool logic by sending a PUT request to the IG API to add the specified epic to the watchlist.async addToWatchlist(watchlistId, epic) { try { const response = await this.apiClient.put(`/watchlists/${watchlistId}`, { epic }); return response.data; } catch (error) { logger.error(`Failed to add ${epic} to watchlist:`, error.message); throw error; } }
- src/services/mcp-service.js:766-775 (handler)MCP server dispatch handler for the tool that calls the IGService method and formats the response.case 'ig_add_to_watchlist': const addResult = await igService.addToWatchlist(args.watchlistId, args.epic); return { content: [ { type: 'text', text: JSON.stringify(addResult, null, 2), }, ], };
- src/services/mcp-service.js:485-502 (schema)Tool schema definition including name, description, and input schema used for registration and validation.{ name: 'ig_add_to_watchlist', description: 'Add an epic to a watchlist', inputSchema: { type: 'object', properties: { watchlistId: { type: 'string', description: 'Watchlist ID', }, epic: { type: 'string', description: 'Epic to add', }, }, required: ['watchlistId', 'epic'], }, },
- src/services/mcp-service.js:506-510 (registration)Registers all tools including ig_add_to_watchlist by setting the ListToolsRequestHandler to return the TOOLS array.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: TOOLS, }; });