Skip to main content
Glama
nonnname

T-Invest MCP Server

by nonnname

get_trading_status

Read-only

Check real-time trading status for T-Invest securities to verify market availability and trading permissions before executing orders.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickersYesМассив тикеров

Implementation Reference

  • The handler function that executes the trading status lookup for a list of tickers.
    async ({ tickers }) => {
      try {
        const settled = await Promise.allSettled(
          tickers.map(async (ticker) => {
            const item = await resolveTickerToInstrument(client, ticker);
            if (!item) return `${ticker}: инструмент не найден`;
    
            const resp = await client.post<GetTradingStatusResponse>(
              API_PATHS.MARKET_DATA.GET_TRADING_STATUS,
              { figi: item.figi },
            );
    
            const status = TRADING_STATUS_LABELS[resp.tradingStatus] ?? resp.tradingStatus;
            const flags: string[] = [];
            if (resp.limitOrderAvailableFlag) flags.push('лимит');
            if (resp.marketOrderAvailableFlag) flags.push('рынок');
            if (resp.apiTradeAvailableFlag) flags.push('API');
    
            return `${ticker}: ${status}${flags.length ? ` (доступно: ${flags.join(', ')})` : ''}`;
          }),
        );
    
        const results = settled.map((r, i) =>
          r.status === 'fulfilled' ? r.value : `${tickers[i]}: ошибка`,
        );
    
        return { content: [{ type: 'text' as const, text: results.join('\n') }] };
      } catch (error) {
        return {
          content: [{ type: 'text' as const, text: `Ошибка: ${error instanceof Error ? error.message : String(error)}` }],
          isError: true,
        };
      }
    },
  • Registration function that defines the 'get_trading_status' MCP tool, its schema, and associates it with the handler.
    export function registerGetTradingStatus(server: McpServer, client: TInvestClient): void {
      server.tool(
        'get_trading_status',
        'Получить статус торгов по тикеру из Т-Инвестиций',
        {
          tickers: z.array(z.string()).min(1).max(50).describe('Массив тикеров'),
        },
        READ_ONLY,
        async ({ tickers }) => {
          try {
            const settled = await Promise.allSettled(
              tickers.map(async (ticker) => {
                const item = await resolveTickerToInstrument(client, ticker);
                if (!item) return `${ticker}: инструмент не найден`;
    
                const resp = await client.post<GetTradingStatusResponse>(
                  API_PATHS.MARKET_DATA.GET_TRADING_STATUS,
                  { figi: item.figi },
                );
    
                const status = TRADING_STATUS_LABELS[resp.tradingStatus] ?? resp.tradingStatus;
                const flags: string[] = [];
                if (resp.limitOrderAvailableFlag) flags.push('лимит');
                if (resp.marketOrderAvailableFlag) flags.push('рынок');
                if (resp.apiTradeAvailableFlag) flags.push('API');
    
                return `${ticker}: ${status}${flags.length ? ` (доступно: ${flags.join(', ')})` : ''}`;
              }),
            );
    
            const results = settled.map((r, i) =>
              r.status === 'fulfilled' ? r.value : `${tickers[i]}: ошибка`,
            );
    
            return { content: [{ type: 'text' as const, text: results.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?

The 'readOnlyHint: true' annotation already establishes this is a safe read operation. The description adds value by specifying the data source ('Т-Инвестиций'), but lacks details about what trading status values mean (e.g., 'normal_trading', 'auction', 'suspended') or caching behavior. With annotations covering safety, this is minimally sufficient.

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?

Description is a single efficient sentence front-loaded with the core action. While appropriately brief for a simple read operation, it borders on underspecified—one additional sentence explaining the status semantics would improve utility without sacrificing conciseness.

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?

Given this is a single-parameter read tool with safety annotations, the description adequately covers the basics. However, without an output schema, the description should ideally clarify what constitutes 'trading status' (enumeration values, meaning of different states) to prepare the agent for interpreting results.

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?

Input schema has 100% description coverage with the 'tickers' parameter documented as 'Массив тикеров'. The tool description does not add examples, format specifications (e.g., 'TCSG' vs 'TCSG.MM'), or explain the 1-50 item limit. At 100% schema coverage, baseline score 3 is appropriate.

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?

The description clearly states the tool retrieves 'trading status' (статус торгов) by ticker from T-Investments, providing specific verb and resource. However, it fails to differentiate from the sibling tool 'get_trading_schedules'—users cannot determine whether this returns current market state (e.g., active/suspended) versus calendar schedule information.

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 like 'get_trading_schedules' or 'get_last_prices'. There is no mention of prerequisites, rate limits, or specific scenarios where trading status is needed versus other market data tools.

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