Skip to main content
Glama
kea0811
by kea0811

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

TableJSON Schema
NameRequiredDescriptionDefault
epicYesEpic to add
watchlistIdYesWatchlist ID

Implementation Reference

  • 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;
      }
    }
  • 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),
          },
        ],
      };
  • 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'],
      },
    },
  • Registers all tools including ig_add_to_watchlist by setting the ListToolsRequestHandler to return the TOOLS array.
    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