Skip to main content
Glama
nonnname

T-Invest MCP Server

by nonnname

get_candles

Read-only

Retrieve historical OHLCV candlestick data for financial instruments from T-Invest. Specify ticker, date range, and interval to analyze price movements and trends.

Instructions

Получить исторические свечи (OHLCV) по тикеру из Т-Инвестиций

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerYesТикер инструмента
fromYesНачало периода (ISO 8601, например 2024-01-01T00:00:00Z)
toYesКонец периода (ISO 8601)
intervalNoИнтервал свечиday

Implementation Reference

  • The `registerGetCandles` function registers the `get_candles` tool and defines its handler logic, which resolves a ticker to a figi, calls the API, and formats the candle output.
    export function registerGetCandles(server: McpServer, client: TInvestClient): void {
      server.tool(
        'get_candles',
        'Получить исторические свечи (OHLCV) по тикеру из Т-Инвестиций',
        {
          ticker: z.string().describe('Тикер инструмента'),
          from: z.string().describe('Начало периода (ISO 8601, например 2024-01-01T00:00:00Z)'),
          to: z.string().describe('Конец периода (ISO 8601)'),
          interval: z
            .enum(['1min', '5min', '15min', 'hour', 'day', 'week', 'month'])
            .default('day')
            .describe('Интервал свечи'),
        },
        READ_ONLY,
        async ({ ticker, from, to, interval }) => {
          try {
            const item = await resolveTickerToInstrument(client, ticker);
            if (!item) {
              return { content: [{ type: 'text' as const, text: `Инструмент "${ticker}" не найден.` }] };
            }
    
            const response = await client.post<GetCandlesResponse>(
              API_PATHS.MARKET_DATA.GET_CANDLES,
              { figi: item.figi, from, to, interval: INTERVAL_MAP[interval] },
            );
    
            if (!response.candles || response.candles.length === 0) {
              return { content: [{ type: 'text' as const, text: 'Свечи не найдены для указанного периода.' }] };
            }
    
            const lines = response.candles.map((c) => {
              const o = quotationToNumber(c.open).toFixed(2);
              const h = quotationToNumber(c.high).toFixed(2);
              const l = quotationToNumber(c.low).toFixed(2);
              const cl = quotationToNumber(c.close).toFixed(2);
              return `${formatDateTime(c.time)} | O:${o} H:${h} L:${l} C:${cl} V:${c.volume}`;
            });
    
            const header = `${ticker} — ${interval} свечи (${response.candles.length} шт.)\n${'─'.repeat(50)}`;
            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 declare readOnlyHint=true. Description adds value by specifying OHLCV data format and T-Investments data source. However, lacks details on pagination, volume limits, or timezone handling that would help predict response size.

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 dense sentence with zero waste. Front-loaded verb, parenthetical clarification of OHLCV acronym, and source attribution maximize information density.

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

Completeness3/5

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

Adequate for a read-only data retrieval tool with 100% parameter coverage. Mentions OHLCV to hint at return structure where no output schema exists, but lacks details on array format, timezone normalization, or trading schedule considerations.

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 excellent Russian descriptions for all 4 parameters including ISO 8601 format examples. Description mentions 'по тикеру' (by ticker) but doesn't add syntax guidance beyond what schema provides; baseline 3 appropriate for complete schema coverage.

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?

Clear verb 'Получить' (Get) with specific resource 'исторические свечи (OHLCV)' and source 'Т-Инвестиций'. Implicitly distinguishes from get_last_prices by specifying 'historical' candles, though explicit sibling comparison is absent.

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 guidance on when to use versus alternatives like get_last_prices (real-time vs historical), no mention of maximum date ranges, rate limits, or prerequisites for using different intervals.

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