Skip to main content
Glama
kea0811
by kea0811

ig_switch_account

Switch to a different trading account on IG Trading by specifying the account ID. Enables users to manage multiple accounts efficiently for forex, indices, and commodities trading.

Instructions

Switch to a different trading account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdYesAccount ID to switch to

Implementation Reference

  • Core handler function that switches the IG trading account by sending a PUT request to '/session' endpoint with the accountId and updates the session tokens.
    async switchAccount(accountId) {
      try {
        const response = await this.apiClient.put('/session', { accountId }, 1);
        
        config.setSessionTokens({
          'x-security-token': response.headers['x-security-token'],
          cst: response.headers.cst,
          lightstreamerEndpoint: config.sessionTokens.lightstreamerEndpoint,
          currentAccountId: accountId
        });
    
        logger.info(`Switched to account: ${accountId}`);
        return response.data;
      } catch (error) {
        logger.error('Account switch failed:', error.message);
        throw error;
      }
  • Tool schema definition including input validation requiring 'accountId'.
    {
      name: 'ig_switch_account',
      description: 'Switch to a different trading account',
      inputSchema: {
        type: 'object',
        properties: {
          accountId: {
            type: 'string',
            description: 'Account ID to switch to',
          },
        },
        required: ['accountId'],
      },
    },
  • MCP server dispatch handler that calls the igService.switchAccount method and formats the response.
    case 'ig_switch_account':
      const switchResult = await igService.switchAccount(args.accountId);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(switchResult, null, 2),
          },
        ],
      };
  • Registers the list of tools including ig_switch_account by returning the TOOLS array in response to ListToolsRequest.
    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. 'Switch to' implies a state change operation, but the description doesn't clarify whether this affects subsequent API calls, requires specific permissions, has side effects on active positions, or what happens if switching fails. For a state-changing tool with zero annotation coverage, this is insufficient.

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 communicates the core purpose without any wasted words. It's appropriately sized for a simple tool with one parameter and gets straight to the point.

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 state-changing tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'switching' entails operationally, what the expected outcome is, or how this affects subsequent API interactions. Given the complexity of account switching in trading systems, more context is needed.

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 has 100% description coverage, with the single parameter 'accountId' clearly documented in the schema as 'Account ID to switch to'. The description doesn't add any additional parameter context beyond what's already in the schema, so the baseline score of 3 is appropriate.

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 ('switch to') and resource ('trading account'), making the purpose immediately understandable. However, it doesn't differentiate this from sibling tools like 'ig_get_accounts' or explain what 'switch' means in this trading context.

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 like 'ig_get_accounts' or 'ig_login', nor does it mention prerequisites such as needing to be logged in first. There's no context about when switching accounts is appropriate versus when to use other account-related tools.

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