Skip to main content
Glama
nonnname

T-Invest MCP Server

by nonnname

get_operations

Read-only

Retrieve historical investment account operations from T-Invest within specified date ranges to track transactions and analyze portfolio activity.

Instructions

Получить историю операций по счёту в Т-Инвестициях

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdYesИдентификатор счёта (можно получить через get_accounts)
fromNoНачало периода (ISO 8601, например 2024-01-01T00:00:00Z)
toNoКонец периода (ISO 8601)
limitNoМаксимальное количество операций

Implementation Reference

  • The `registerGetOperations` function registers the `get_operations` MCP tool and contains the core logic for fetching and formatting operations from the T-Invest API.
    export function registerGetOperations(server: McpServer, client: TInvestClient): void {
      server.tool(
        'get_operations',
        'Получить историю операций по счёту в Т-Инвестициях',
        {
          accountId: z.string().describe('Идентификатор счёта (можно получить через get_accounts)'),
          from: z.string().optional().describe('Начало периода (ISO 8601, например 2024-01-01T00:00:00Z)'),
          to: z.string().optional().describe('Конец периода (ISO 8601)'),
          limit: z.number().int().min(1).max(1000).default(50).describe('Максимальное количество операций'),
        },
        READ_ONLY,
        async ({ accountId, from, to, limit }) => {
          try {
            const body: Record<string, unknown> = { accountId, limit };
            if (from) body.from = from;
            if (to) body.to = to;
    
            const response = await client.post<GetOperationsByCursorResponse>(
              API_PATHS.OPERATIONS.GET_OPERATIONS_BY_CURSOR,
              body,
            );
    
            if (!response.items || response.items.length === 0) {
              return { content: [{ type: 'text' as const, text: 'Операции не найдены.' }] };
            }
    
            const lines = response.items.map((op) => {
              const parts = [
                `Дата: ${formatDateTime(op.date)}`,
                `Тип: ${OPERATION_TYPE_LABELS[op.type] ?? op.type}`,
              ];
              if (op.name) parts.push(`Инструмент: ${op.name}`);
              if (op.payment) parts.push(`Сумма: ${formatMoney(op.payment)}`);
              if (op.price && op.quantity) {
                parts.push(`Цена: ${formatMoney(op.price)}, Количество: ${op.quantityDone ?? op.quantity}`);
              }
              if (op.commissionSum) parts.push(`Комиссия: ${formatMoney(op.commissionSum)}`);
              return parts.join('\n');
            });
    
            let text = lines.join(SEPARATOR);
            if (response.hasnext) {
              text += '\n\n(Есть ещё операции. Уточните период или уменьшите limit.)';
            }
    
            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,
            };
          }
        },
      );
Behavior3/5

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

Annotations declare readOnlyHint=true, confirming safe read operation. Description adds domain context ('Т-Инвестициях' / T-Investments) helping identify this as brokerage transaction history, but lacks details on what operation types are returned, result ordering, or time range limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence of 6 words is appropriately dense and front-loaded with the action and resource. However, extreme brevity sacrifices behavioral details that would help an agent understand result semantics and pagination.

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 history retrieval tool with well-documented input schema. Missing output semantics (what operations are included) but acceptable given annotations confirm read-only safety and siblings suggest this is transaction history distinct from active orders.

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 description coverage is 100% with detailed parameter descriptions including cross-references (accountId) and format examples (ISO 8601). The description text itself adds no parameter-specific guidance, warranting the baseline score for well-documented schemas.

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?

Uses specific verb 'Получить' (Get) with resource 'историю операций' (operation history) and scope 'по счёту в Т-Инвестициях' (by account in T-Investments). Clearly distinguishes from sibling tools like get_accounts (lists accounts) and get_portfolio (current positions), though could clarify what 'operations' encompasses (trades, fees, dividends, etc.).

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?

Provides no guidance on when to use this tool versus alternatives like get_orders or get_portfolio. No mention of date range requirements, pagination behavior, or that accountId should be obtained from get_accounts (though this appears in parameter schema descriptions, not the main description text).

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