Skip to main content
Glama
nonnname

T-Invest MCP Server

by nonnname

cancel_order

Cancel a stock exchange order in T-Invest by providing account and order IDs. Requires confirmation to execute the cancellation.

Instructions

Отменить биржевую заявку в Т-Инвестициях (требуется confirm: true для исполнения)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdYesИдентификатор счёта
orderIdYesID заявки (можно получить через get_orders)
confirmNoПередайте true для подтверждения отмены

Implementation Reference

  • The handler logic for the 'cancel_order' tool.
    async ({ accountId, orderId, confirm }) => {
      try {
        if (requireConfirmation && confirm !== true) {
          return {
            content: [{
              type: 'text' as const,
              text: `Подтвердите отмену заявки:\n  ID заявки: ${orderId}\n  Счёт: ${accountId}\n\nДля отмены вызовите повторно с confirm: true`,
            }],
          };
        }
    
        const response = await client.post<CancelOrderResponse>(
          API_PATHS.ORDERS.CANCEL_ORDER,
          { accountId, orderId },
        );
    
        return {
          content: [{ type: 'text' as const, text: `Заявка ${orderId} отменена в ${formatDateTime(response.time)}` }],
        };
      } catch (error) {
        return {
          content: [{ type: 'text' as const, text: `Ошибка: ${error instanceof Error ? error.message : String(error)}` }],
          isError: true,
        };
      }
    },
  • Registration of the 'cancel_order' tool within the server.
    server.tool(
      'cancel_order',
      requireConfirmation
        ? 'Отменить биржевую заявку в Т-Инвестициях (требуется confirm: true для исполнения)'
        : 'Отменить биржевую заявку в Т-Инвестициях',
      {
        accountId: z.string().describe('Идентификатор счёта'),
        orderId: z.string().describe('ID заявки (можно получить через get_orders)'),
        confirm: z.boolean().optional().describe('Передайте true для подтверждения отмены'),
      },
      DESTRUCTIVE,
      async ({ accountId, orderId, confirm }) => {
        try {
          if (requireConfirmation && confirm !== true) {
            return {
              content: [{
                type: 'text' as const,
                text: `Подтвердите отмену заявки:\n  ID заявки: ${orderId}\n  Счёт: ${accountId}\n\nДля отмены вызовите повторно с confirm: true`,
              }],
            };
          }
    
          const response = await client.post<CancelOrderResponse>(
            API_PATHS.ORDERS.CANCEL_ORDER,
            { accountId, orderId },
          );
    
          return {
            content: [{ type: 'text' as const, text: `Заявка ${orderId} отменена в ${formatDateTime(response.time)}` }],
          };
        } catch (error) {
          return {
            content: [{ type: 'text' as const, text: `Ошибка: ${error instanceof Error ? error.message : String(error)}` }],
            isError: true,
          };
        }
      },
    );

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/nonnname/t-invest-mcp-server'

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