Skip to main content
Glama

ig_update_position

Modify stop loss, take profit, and trailing stop levels for an open position using deal ID on IG Trading MCP. Adjust risk management parameters dynamically while trading forex, indices, or commodities.

Instructions

Update stop/limit levels for an open position

Input Schema

NameRequiredDescriptionDefault
dealIdYesDeal ID of the position to update
limitLevelNoNew take profit level
stopLevelNoNew stop loss level
trailingStopNoEnable trailing stop
trailingStopDistanceNoTrailing stop distance

Input Schema (JSON Schema)

{ "properties": { "dealId": { "description": "Deal ID of the position to update", "type": "string" }, "limitLevel": { "description": "New take profit level", "type": "number" }, "stopLevel": { "description": "New stop loss level", "type": "number" }, "trailingStop": { "description": "Enable trailing stop", "type": "boolean" }, "trailingStopDistance": { "description": "Trailing stop distance", "type": "number" } }, "required": [ "dealId" ], "type": "object" }

Implementation Reference

  • Core handler function that performs the IG API PUT request to update position levels (stop, limit, trailing stop).
    async updatePosition(dealId, updates) { try { const response = await this.apiClient.put(`/positions/otc/${dealId}`, updates, 2); if (response.data.dealReference) { const confirmation = await this.getConfirmation(response.data.dealReference); return { position: response.data, confirmation }; } return response.data; } catch (error) { logger.error('Failed to update position:', error.message); throw error; } }
  • Input schema definition for the ig_update_position tool, defining parameters like dealId, stopLevel, limitLevel, etc.
    name: 'ig_update_position', description: 'Update stop/limit levels for an open position', inputSchema: { type: 'object', properties: { dealId: { type: 'string', description: 'Deal ID of the position to update', }, stopLevel: { type: 'number', description: 'New stop loss level', }, limitLevel: { type: 'number', description: 'New take profit level', }, trailingStop: { type: 'boolean', description: 'Enable trailing stop', }, trailingStopDistance: { type: 'number', description: 'Trailing stop distance', }, }, required: ['dealId'], }, },
  • MCP server handler that dispatches the tool call to igService.updatePosition and formats the response.
    case 'ig_update_position': const updateResult = await igService.updatePosition(args.dealId, args); return { content: [ { type: 'text', text: JSON.stringify(updateResult, null, 2), }, ], };
  • Registers the list of tools (including ig_update_position schema from TOOLS array) with the MCP server.
    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