Skip to main content
Glama
enderekici

Trading 212 MCP Server

by enderekici

cancel_order

Cancel an active trading order by its unique ID to manage positions and control investment execution.

Instructions

Cancel an active order by order ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orderIdYesThe unique identifier of the order to cancel

Implementation Reference

  • The core implementation that sends the DELETE request to the server to cancel an order.
    async cancelOrder(orderId: number): Promise<void> {
      await this.request(`/equity/orders/${orderId}`, {
        method: 'DELETE',
      });
    }
  • The MCP tool handler logic that validates input and calls the client implementation.
    case 'cancel_order': {
      const { orderId } = OrderIdInputSchema.parse(args);
      await client.cancelOrder(orderId);
      return {
        content: [
          {
            type: 'text',
            text: `Order ${orderId} cancelled successfully`,
          },
        ],
      };
  • Input validation schema for the cancel_order tool.
    const OrderIdInputSchema = z.object({
      orderId: z.number(),
    });
  • src/index.ts:139-147 (registration)
    MCP tool registration for cancel_order.
    {
      name: 'cancel_order',
      description: 'Cancel an active order by order ID',
      inputSchema: {
        type: 'object',
        properties: {
          orderId: {
            type: 'number',
            description: 'The unique identifier of the order to cancel',

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/enderekici/trading212-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server