Skip to main content
Glama
nonnname

T-Invest MCP Server

by nonnname

get_orders

Read-only

Retrieve active exchange orders for a T-Invest account to monitor pending trades and manage investment positions.

Instructions

Получить активные биржевые заявки по счёту в Т-Инвестициях

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdYesИдентификатор счёта (можно получить через get_accounts)

Implementation Reference

  • The handler implementation for the 'get_orders' MCP tool.
    server.tool(
      'get_orders',
      'Получить активные биржевые заявки по счёту в Т-Инвестициях',
      {
        accountId: z.string().describe('Идентификатор счёта (можно получить через get_accounts)'),
      },
      READ_ONLY,
      async ({ accountId }) => {
        try {
          const response = await client.post<GetOrdersResponse>(
            API_PATHS.ORDERS.GET_ORDERS,
            { accountId },
          );
    
          if (!response.orders || response.orders.length === 0) {
            return { content: [{ type: 'text' as const, text: 'Активных заявок нет.' }] };
          }
    
          const settled = await inBatches(
            response.orders,
            (order) => resolveInstrumentByFigi(client, order.figi),
          );
    
          const lines = response.orders.map((order, i) => {
            const result = settled[i];
            const ticker = (result.status === 'fulfilled' && result.value) ? result.value : order.figi;
            const parts = [
              `Тикер: ${ticker}`,
              `Направление: ${DIRECTION_LABELS[order.direction] ?? order.direction}`,
              `Тип: ${ORDER_TYPE_LABELS[order.orderType] ?? order.orderType}`,
              `Статус: ${ORDER_STATUS_LABELS[order.executionReportStatus] ?? order.executionReportStatus}`,
              `Лотов запрошено / исполнено: ${order.lotsRequested} / ${order.lotsExecuted}`,
            ];
            if (order.initialOrderPrice) parts.push(`Цена заявки: ${formatMoney(order.initialOrderPrice)}`);
            if (order.totalOrderAmount) parts.push(`Сумма: ${formatMoney(order.totalOrderAmount)}`);
            if (order.orderDate) parts.push(`Дата: ${formatDateTime(order.orderDate)}`);
            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,
          };
        }
      },
    );
  • Registration function for the 'get_orders' MCP tool.
    export function registerGetOrders(server: McpServer, client: TInvestClient): void {
      server.tool(
        'get_orders',
        'Получить активные биржевые заявки по счёту в Т-Инвестициях',
        {
          accountId: z.string().describe('Идентификатор счёта (можно получить через get_accounts)'),
        },
        READ_ONLY,
        async ({ accountId }) => {
          try {
            const response = await client.post<GetOrdersResponse>(
              API_PATHS.ORDERS.GET_ORDERS,
              { accountId },
            );
    
            if (!response.orders || response.orders.length === 0) {
              return { content: [{ type: 'text' as const, text: 'Активных заявок нет.' }] };
            }
    
            const settled = await inBatches(
              response.orders,
              (order) => resolveInstrumentByFigi(client, order.figi),
            );
    
            const lines = response.orders.map((order, i) => {
              const result = settled[i];
              const ticker = (result.status === 'fulfilled' && result.value) ? result.value : order.figi;
              const parts = [
                `Тикер: ${ticker}`,
                `Направление: ${DIRECTION_LABELS[order.direction] ?? order.direction}`,
                `Тип: ${ORDER_TYPE_LABELS[order.orderType] ?? order.orderType}`,
                `Статус: ${ORDER_STATUS_LABELS[order.executionReportStatus] ?? order.executionReportStatus}`,
                `Лотов запрошено / исполнено: ${order.lotsRequested} / ${order.lotsExecuted}`,
              ];
              if (order.initialOrderPrice) parts.push(`Цена заявки: ${formatMoney(order.initialOrderPrice)}`);
              if (order.totalOrderAmount) parts.push(`Сумма: ${formatMoney(order.totalOrderAmount)}`);
              if (order.orderDate) parts.push(`Дата: ${formatDateTime(order.orderDate)}`);
              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,
            };
          }
        },
      );
    }
Behavior3/5

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

The description specifies the 'active' state filter, which is useful behavioral context not present in the tool name. However, with readOnlyHint annotating the safety profile, the description carries a lighter burden—it doesn't elaborate on pagination, rate limits, or what constitutes 'active' beyond the single word.

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?

The description is a single, dense Russian sentence with zero filler. It front-loads the action verb immediately followed by the resource type and scope, making every word essential.

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?

For a simple read-only getter with one required parameter, good annotations (readOnlyHint), and clear scope, the description is nearly complete. It lacks output schema documentation, but given the tool's simplicity and the clarity of 'active orders,' this is acceptable for selection and invocation.

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 for the single accountId parameter, the baseline is 3. The description mentions 'по счёту' (by account) which aligns with the parameter, but doesn't add syntax details, validation rules, or format examples beyond what the schema already provides.

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 a specific verb ('Получить'/Get) and clearly identifies the resource as 'active exchange orders' (активные биржевые заявки), which distinguishes it from sibling tools like get_stop_orders (stop orders) and get_operations (historical trades). The 'биржевые' (exchange) qualifier specifically distinguishes these from stop orders.

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 explicit guidance on when to use this tool versus alternatives (e.g., get_stop_orders for conditional orders, cancel_order for removing orders) or any prerequisites beyond the implicit need for an account ID. While the schema references get_accounts for the parameter, the description lacks 'when-to-use' context.

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