Skip to main content
Glama
nonnname

T-Invest MCP Server

by nonnname

get_signals

Retrieve trading signals from T-Invest with filters for tickers, time periods, and buy/sell directions to inform investment decisions.

Instructions

Получить торговые сигналы из Т-Инвестиций

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickersNoФильтр по тикерам (если не указан — все сигналы)
fromNoНачало периода (ISO 8601)
toNoКонец периода (ISO 8601)
directionNoФильтр по направлению: buy — покупка, sell — продажа
limitNoМаксимальное количество сигналов

Implementation Reference

  • The 'get_signals' tool registration and handler implementation. It uses Zod for input validation and communicates with the TInvestClient to fetch trading signals.
    export function registerGetSignals(server: McpServer, client: TInvestClient): void {
      server.tool(
        'get_signals',
        'Получить торговые сигналы из Т-Инвестиций',
        {
          tickers: z.array(z.string()).optional().describe('Фильтр по тикерам (если не указан — все сигналы)'),
          from: z.string().optional().describe('Начало периода (ISO 8601)'),
          to: z.string().optional().describe('Конец периода (ISO 8601)'),
          direction: z
            .enum(['buy', 'sell'])
            .optional()
            .describe('Фильтр по направлению: buy — покупка, sell — продажа'),
          limit: z.number().int().min(1).max(100).default(20).describe('Максимальное количество сигналов'),
        },
        READ_ONLY,
        async ({ tickers, from, to, direction, limit }) => {
          try {
            let instrumentUids: string[] = [];
            if (tickers && tickers.length > 0) {
              const instrumentMap = await resolveTickersToInstruments(client, tickers);
              instrumentUids = Array.from(instrumentMap.values()).map((i) => i.uid);
            }
    
            const body: Record<string, unknown> = {
              paging: { pageNumber: 0, pageSize: limit },
            };
            if (instrumentUids.length === 1) body.instrumentUid = instrumentUids[0];
            if (from) body.from = from;
            if (to) body.to = to;
            if (direction) {
              body.direction = direction === 'buy' ? 'SIGNAL_DIRECTION_BUY' : 'SIGNAL_DIRECTION_SELL';
            }
    
            const response = await client.post<GetSignalsResponse>(
              API_PATHS.SIGNALS.GET_SIGNALS,
              body,
            );
    
            if (!response.signals || response.signals.length === 0) {
              return { content: [{ type: 'text' as const, text: 'Сигналы не найдены.' }] };
            }
    
            const lines = response.signals.map((s) => {
              const parts = [
                `Направление: ${DIRECTION_LABELS[s.direction] ?? s.direction}`,
                `Дата: ${formatDateTime(s.createdAt)}`,
              ];
              if (s.name) parts.push(`Название: ${s.name}`);
              if (s.description) parts.push(`Описание: ${s.description}`);
              if (s.targetPrice) parts.push(`Целевая цена: ${quotationToNumber(s.targetPrice).toFixed(2)}`);
              if (s.openPrice) parts.push(`Цена открытия: ${quotationToNumber(s.openPrice).toFixed(2)}`);
              if (s.validUntil) parts.push(`Действует до: ${formatDateTime(s.validUntil)}`);
              return parts.join('\n');
            });
    
            return { content: [{ type: 'text' as const, text: lines.join(SEPARATOR) }] };
          } 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