Skip to main content
Glama
kea0811
by kea0811

ig_create_working_order

Place a working order on IG Trading by specifying epic, direction, size, currency, expiry, type, level, and time in force. Manage stop loss, take profit, and use guaranteed stops for forex, indices, and commodities trading.

Instructions

Create a working order

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
currencyCodeYesCurrency code
directionYesTrade direction
epicYesMarket epic code
expiryYesContract expiry
forceOpenNoForce open a new position
goodTillDateNoExpiry date for GOOD_TILL_DATE orders
guaranteedStopNoUse guaranteed stop
levelYesEntry level
limitLevelNoTake profit level
sizeYesOrder size
stopLevelNoStop loss level
timeInForceYesTime in force
typeYesOrder type

Implementation Reference

  • Core handler that validates input, posts working order to IG API endpoint /workingorders/otc, and retrieves confirmation if available.
    async createWorkingOrder(ticket) {
      this.validateWorkingOrderTicket(ticket);
      
      try {
        const response = await this.apiClient.post('/workingorders/otc', ticket, 2);
        
        if (response.data.dealReference) {
          const confirmation = await this.getConfirmation(response.data.dealReference);
          return {
            order: response.data,
            confirmation
          };
        }
        
        return response.data;
      } catch (error) {
        logger.error('Failed to create working order:', error.message);
        throw error;
      }
    }
  • Input schema and tool metadata definition used for tool listing and validation.
    {
      name: 'ig_create_working_order',
      description: 'Create a working order',
      inputSchema: {
        type: 'object',
        properties: {
          epic: {
            type: 'string',
            description: 'Market epic code',
          },
          direction: {
            type: 'string',
            enum: ['BUY', 'SELL'],
            description: 'Trade direction',
          },
          size: {
            type: 'number',
            description: 'Order size',
          },
          currencyCode: {
            type: 'string',
            description: 'Currency code',
          },
          expiry: {
            type: 'string',
            description: 'Contract expiry',
          },
          type: {
            type: 'string',
            enum: ['LIMIT', 'STOP'],
            description: 'Order type',
          },
          level: {
            type: 'number',
            description: 'Entry level',
          },
          stopLevel: {
            type: 'number',
            description: 'Stop loss level',
          },
          limitLevel: {
            type: 'number',
            description: 'Take profit level',
          },
          guaranteedStop: {
            type: 'boolean',
            description: 'Use guaranteed stop',
            default: false,
          },
          forceOpen: {
            type: 'boolean',
            description: 'Force open a new position',
            default: true,
          },
          timeInForce: {
            type: 'string',
            enum: ['GOOD_TILL_CANCELLED', 'GOOD_TILL_DATE'],
            description: 'Time in force',
          },
          goodTillDate: {
            type: 'string',
            description: 'Expiry date for GOOD_TILL_DATE orders',
          },
        },
        required: ['epic', 'direction', 'size', 'currencyCode', 'expiry', 'type', 'level', 'timeInForce'],
      },
    },
  • MCP server tool dispatch case that calls the IGService handler and formats the response.
    case 'ig_create_working_order':
      const orderResult = await igService.createWorkingOrder(args);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(orderResult, null, 2),
          },
        ],
      };
  • Helper function that validates the working order ticket parameters before API submission.
    validateWorkingOrderTicket(ticket) {
      const required = ['currencyCode', 'direction', 'epic', 'expiry', 'size', 'forceOpen', 'type', 'guaranteedStop', 'timeInForce', 'level'];
      const missing = required.filter(field => ticket[field] === undefined);
      
      if (missing.length > 0) {
        throw new Error(`Missing required fields: ${missing.join(', ')}`);
      }
    
      if (!['LIMIT', 'STOP'].includes(ticket.type)) {
        throw new Error('Order type must be LIMIT or STOP');
      }
    
      if (!['GOOD_TILL_CANCELLED', 'GOOD_TILL_DATE'].includes(ticket.timeInForce)) {
        throw new Error('TimeInForce must be GOOD_TILL_CANCELLED or GOOD_TILL_DATE');
      }
    }
Behavior1/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but offers none. 'Create a working order' doesn't indicate whether this is a high-risk financial transaction, what permissions are required, whether it's idempotent, what happens on failure, or what the expected response format might be. For a trading tool with significant financial implications, this lack of behavioral context is critically inadequate.

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

Conciseness2/5

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

While technically concise with just three words, this is under-specification rather than effective conciseness. The description fails to provide essential context that would help an agent understand and use the tool correctly. Every sentence should earn its place, but this single phrase doesn't provide enough value to justify its existence as a helpful description.

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

Completeness1/5

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

Given the complexity of a financial trading tool with 13 parameters (8 required), no annotations, and no output schema, the description is completely inadequate. It doesn't explain what a 'working order' is, how it differs from regular positions, what the tool returns, or any behavioral characteristics. For a tool with this level of complexity and potential risk, the description fails to provide the necessary context for safe and effective use.

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?

The schema description coverage is 100%, meaning all 13 parameters are documented in the input schema itself. The description adds no additional parameter information beyond what's already in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description, which applies here.

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

Purpose2/5

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

The description 'Create a working order' is a tautology that essentially restates the tool name 'ig_create_working_order'. While it indicates this is a creation operation, it doesn't specify what a 'working order' is in this financial trading context or distinguish it from similar tools like 'ig_create_position'. The purpose remains vague without domain-specific clarification.

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

Usage Guidelines1/5

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

The description provides absolutely no guidance on when to use this tool versus alternatives. There's no mention of prerequisites, appropriate contexts, or comparison to sibling tools like 'ig_create_position' or 'ig_delete_working_order'. An agent would have no indication of when this specific order creation tool should be selected over other trading operations.

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