Skip to main content
Glama
nonnname

T-Invest MCP Server

by nonnname

get_dividends

Read-only

Retrieve dividend payment data for specified stock tickers from T-Invest, allowing users to analyze income distributions within defined time periods.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickersYesМассив тикеров (до 50)
fromNoНачало периода (ISO 8601, например 2024-01-01T00:00:00Z)
toNoКонец периода (ISO 8601)

Implementation Reference

  • The handler function that executes the logic for fetching dividends, processing tickers, and formatting the response.
    async ({ tickers, from, to }) => {
      try {
        const instrumentMap = await resolveTickersToInstruments(client, tickers);
        const notFound = tickers.filter((t) => !instrumentMap.has(t.toUpperCase()));
        const results: string[] = [];
    
        await Promise.allSettled(
          tickers
            .filter((t) => instrumentMap.has(t.toUpperCase()))
            .map(async (ticker) => {
              const instrument = instrumentMap.get(ticker.toUpperCase())!;
              const body: Record<string, unknown> = { figi: instrument.figi };
              if (from) body.from = from;
              if (to) body.to = to;
    
              try {
                const resp = await client.post<GetDividendsResponse>(
                  API_PATHS.INSTRUMENTS.GET_DIVIDENDS,
                  body,
                );
    
                if (!resp.dividends || resp.dividends.length === 0) {
                  results.push(`${ticker}: дивиденды не найдены`);
                  return;
                }
    
                const divLines = resp.dividends.map((d) => {
                  const parts = [`  Дата отсечки: ${formatDate(d.lastBuyDate)}`];
                  if (d.paymentDate) parts.push(`  Дата выплаты: ${formatDate(d.paymentDate)}`);
                  if (d.dividendNet) parts.push(`  Размер: ${formatMoney(d.dividendNet)}`);
                  if (d.yieldValue) parts.push(`  Доходность: ${quotationToNumber(d.yieldValue).toFixed(2)}%`);
                  if (d.dividendType) parts.push(`  Тип: ${d.dividendType}`);
                  return parts.join('\n');
                });
    
                results.push(`${ticker}:\n${divLines.join('\n\n')}`);
              } catch {
                results.push(`${ticker}: ошибка запроса`);
              }
            }),
        );
    
        if (notFound.length > 0) {
          results.push(`\nНе найдены: ${notFound.join(', ')}`);
        }
    
        const text = results.length > 0 ? results.join(SEPARATOR) : 'Данные не найдены.';
        return { content: [{ type: 'text' as const, text }] };
      } catch (error) {
        return {
          content: [{ type: 'text' as const, text: `Ошибка: ${error instanceof Error ? error.message : String(error)}` }],
          isError: true,
        };
      }
    },
  • Registration of the 'get_dividends' tool using the MCP server instance.
    export function registerGetDividends(server: McpServer, client: TInvestClient): void {
      server.tool(
        'get_dividends',
        'Получить дивидендные выплаты по тикерам из Т-Инвестиций',
        {
          tickers: z.array(z.string()).min(1).max(50).describe('Массив тикеров (до 50)'),
          from: z.string().optional().describe('Начало периода (ISO 8601, например 2024-01-01T00:00:00Z)'),
          to: z.string().optional().describe('Конец периода (ISO 8601)'),
        },
        READ_ONLY,
        async ({ tickers, from, to }) => {
          try {
            const instrumentMap = await resolveTickersToInstruments(client, tickers);
            const notFound = tickers.filter((t) => !instrumentMap.has(t.toUpperCase()));
            const results: string[] = [];
    
            await Promise.allSettled(
              tickers
                .filter((t) => instrumentMap.has(t.toUpperCase()))
                .map(async (ticker) => {
                  const instrument = instrumentMap.get(ticker.toUpperCase())!;
                  const body: Record<string, unknown> = { figi: instrument.figi };
                  if (from) body.from = from;
                  if (to) body.to = to;
    
                  try {
                    const resp = await client.post<GetDividendsResponse>(
                      API_PATHS.INSTRUMENTS.GET_DIVIDENDS,
                      body,
                    );
    
                    if (!resp.dividends || resp.dividends.length === 0) {
                      results.push(`${ticker}: дивиденды не найдены`);
                      return;
                    }
    
                    const divLines = resp.dividends.map((d) => {
                      const parts = [`  Дата отсечки: ${formatDate(d.lastBuyDate)}`];
                      if (d.paymentDate) parts.push(`  Дата выплаты: ${formatDate(d.paymentDate)}`);
                      if (d.dividendNet) parts.push(`  Размер: ${formatMoney(d.dividendNet)}`);
                      if (d.yieldValue) parts.push(`  Доходность: ${quotationToNumber(d.yieldValue).toFixed(2)}%`);
                      if (d.dividendType) parts.push(`  Тип: ${d.dividendType}`);
                      return parts.join('\n');
                    });
    
                    results.push(`${ticker}:\n${divLines.join('\n\n')}`);
                  } catch {
                    results.push(`${ticker}: ошибка запроса`);
                  }
                }),
            );
    
            if (notFound.length > 0) {
              results.push(`\nНе найдены: ${notFound.join(', ')}`);
            }
    
            const text = results.length > 0 ? results.join(SEPARATOR) : 'Данные не найдены.';
            return { content: [{ type: 'text' as const, text }] };
          } catch (error) {
            return {
              content: [{ type: 'text' as const, text: `Ошибка: ${error instanceof Error ? error.message : String(error)}` }],
              isError: true,
            };
          }
        },
      );
    }
  • Input validation schema using Zod for the 'get_dividends' tool.
    {
      tickers: z.array(z.string()).min(1).max(50).describe('Массив тикеров (до 50)'),
      from: z.string().optional().describe('Начало периода (ISO 8601, например 2024-01-01T00:00:00Z)'),
      to: z.string().optional().describe('Конец периода (ISO 8601)'),
    },
Behavior3/5

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

The description adds the data source context ('Т-Инвестиций') which is valuable beyond the annotations. While the readOnlyHint annotation confirms this is safe to call, the description doesn't elaborate on behavior like what happens when no dividends exist in the date range, pagination limits, or currency formatting in the response.

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, front-loaded with action and resource. No redundant words or tautology. Appropriate length for a simple data retrieval tool.

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?

Given this is a straightforward read operation with three well-documented parameters and readOnly annotations, the description is sufficient. However, no output schema exists and the description doesn't hint at the return structure (dividend amounts per share, dates, currencies), which would be helpful 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?

With 100% schema description coverage (all parameters documented with types, formats, and constraints), the baseline is 3. The description doesn't add additional semantic context beyond the schema (e.g., it doesn't explain that dates default to all-time if omitted), but it doesn't need to given the excellent schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses the specific verb 'Получить' (Get/Obtain) with the clear resource 'дивидендные выплаты' (dividend payments) and source 'Т-Инвестиций' (T-Investments). It effectively distinguishes from siblings like get_bond_coupons (bond payments) and get_candles (price data) by specifying dividends specifically.

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?

The description provides no guidance on when to use this tool versus alternatives (e.g., when to use get_asset_fundamentals instead), nor does it mention prerequisites like date range requirements or the fact that from/to dates are optional while tickers are required.

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