Skip to main content
Glama
nonnname

T-Invest MCP Server

by nonnname

get_tech_analysis

Read-only

Retrieve technical analysis indicators (BB, EMA, RSI, MACD, SMA) for financial instruments using T-Invest API data to support investment decisions.

Instructions

Получить технический анализ (BB, EMA, RSI, MACD, SMA) по тикеру из Т-Инвестиций

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerYesТикер инструмента
indicatorYesТип индикатора
fromYesНачало периода (ISO 8601)
toYesКонец периода (ISO 8601)
intervalNoИнтервалday
lengthNoПериод индикатора

Implementation Reference

  • The implementation of the 'get_tech_analysis' tool handler, which includes parameter validation using Zod and logic to call the external API via the TInvest client.
    export function registerGetTechAnalysis(server: McpServer, client: TInvestClient): void {
      server.tool(
        'get_tech_analysis',
        'Получить технический анализ (BB, EMA, RSI, MACD, SMA) по тикеру из Т-Инвестиций',
        {
          ticker: z.string().describe('Тикер инструмента'),
          indicator: z.enum(['BB', 'EMA', 'RSI', 'MACD', 'SMA']).describe('Тип индикатора'),
          from: z.string().describe('Начало периода (ISO 8601)'),
          to: z.string().describe('Конец периода (ISO 8601)'),
          interval: z
            .enum(['1min', '5min', '15min', 'hour', 'day', 'week', 'month'])
            .default('day')
            .describe('Интервал'),
          length: z.number().int().min(1).max(200).default(14).describe('Период индикатора'),
        },
        READ_ONLY,
        async ({ ticker, indicator, from, to, interval, length }) => {
          try {
            const instrument = await resolveTickerToInstrument(client, ticker);
            if (!instrument) {
              return { content: [{ type: 'text' as const, text: `Инструмент "${ticker}" не найден.` }], isError: true };
            }
    
            const response = await client.post<GetTechAnalysisResponse>(
              API_PATHS.MARKET_DATA.GET_TECH_ANALYSIS,
              {
                indicatorType: INDICATOR_MAP[indicator],
                instrumentUid: instrument.uid,
                from,
                to,
                interval: INTERVAL_MAP[interval],
                typeOfPrice: 'TYPE_OF_PRICE_CLOSE',
                length,
              },
            );
    
            if (!response.technicalIndicators || response.technicalIndicators.length === 0) {
              return { content: [{ type: 'text' as const, text: 'Данные технического анализа не найдены.' }] };
            }
    
            const fmt = (q: Parameters<typeof quotationToNumber>[0]) =>
              q ? quotationToNumber(q).toFixed(4) : 'н/д';
    
            const header = `${ticker} — ${indicator}(${length}), ${interval}\n${'─'.repeat(50)}`;
            const lines = response.technicalIndicators.map((ti) => {
              const parts: string[] = [formatDateTime(ti.timestamp)];
              if (ti.middleBand !== undefined) parts.push(`Mid: ${fmt(ti.middleBand)}`);
              if (ti.upperBand !== undefined) parts.push(`Up: ${fmt(ti.upperBand)}`);
              if (ti.lowerBand !== undefined) parts.push(`Low: ${fmt(ti.lowerBand)}`);
              if (ti.signal !== undefined) parts.push(`Signal: ${fmt(ti.signal)}`);
              if (ti.macd !== undefined) parts.push(`MACD: ${fmt(ti.macd)}`);
              if (ti.rsi !== undefined) parts.push(`RSI: ${fmt(ti.rsi)}`);
              return parts.join(' | ');
            });
    
            return { content: [{ type: 'text' as const, text: `${header}\n${lines.join('\n')}` }] };
          } catch (error) {
            return {
              content: [{ type: 'text' as const, text: `Ошибка: ${error instanceof Error ? error.message : String(error)}` }],
              isError: true,
            };
          }
        },
      );
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations provide readOnlyHint=true. Description adds data source context ('Т-Инвестиций') and enumerates available indicators, but lacks disclosure on rate limits, error handling, or date range constraints.

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?

Single sentence with action-fronted structure. Every element earns its place: verb, resource specification, parameter hint (indicators), and source. Zero waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 100% schema coverage and readOnly annotations, the description adequately covers purpose and source. No output schema exists, but for a standard data retrieval tool, the description provides sufficient context.

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?

Schema coverage is 100% with complete parameter documentation. Description reinforces the indicator options by listing them explicitly, but does not add semantic meaning beyond what the schema already provides.

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?

Description uses specific verb 'Получить' (Get) with clear resource 'технический анализ' and lists specific indicator types (BB, EMA, RSI, MACD, SMA), distinguishing it from generic price data tools like get_candles.

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?

No explicit guidance on when to use this tool versus alternatives (e.g., get_candles for raw price data) or prerequisites for the ticker parameter.

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

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