Skip to main content
Glama
kea0811
by kea0811

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

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

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,
      };
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states 'Update' which implies a write/mutation operation, but doesn't clarify critical aspects: whether this requires specific permissions, if changes are reversible, potential rate limits, or what happens on success/failure. For a financial trading tool modifying open positions, this lack of behavioral context is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that gets straight to the point with zero wasted words. It's appropriately sized for a tool with clear parameters and no complex behavioral nuances needing explanation. The front-loaded structure immediately communicates the core functionality.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a financial trading tool that modifies open positions (a potentially sensitive operation), the description is inadequate. With no annotations, no output schema, and minimal behavioral context, the agent lacks critical information about permissions, side effects, error conditions, and return values. The 100% schema coverage helps with parameters, but doesn't compensate for the overall contextual gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all parameters are documented in the schema itself. The description adds minimal value beyond what's in the schema - it mentions 'stop/limit levels' which aligns with stopLevel and limitLevel parameters, but doesn't provide additional context about parameter interactions (e.g., how trailingStop relates to stopLevel) or usage examples. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Update') and target ('stop/limit levels for an open position'), making the purpose immediately understandable. It distinguishes itself from siblings like 'ig_close_position' or 'ig_create_position' by focusing on modifying existing positions rather than creating or closing them. However, it doesn't explicitly differentiate from potential alternatives like 'ig_create_working_order' which might also involve order management.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an open position identified by dealId), when not to use it (e.g., for closed positions), or how it differs from related tools like 'ig_create_working_order' for setting orders. The agent must infer usage from the tool name and parameters alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related 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