Skip to main content
Glama
nonnname

T-Invest MCP Server

by nonnname

get_last_prices

Read-only

Retrieve current market prices for specified tickers from T-Invest to monitor portfolio values and track financial instruments.

Instructions

Получить текущие рыночные цены по тикерам в Т-Инвестициях

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickersYesМассив тикеров (до 100)

Implementation Reference

  • The tool registration and handler implementation for "get_last_prices".
    server.tool(
      'get_last_prices',
      'Получить текущие рыночные цены по тикерам в Т-Инвестициях',
      {
        tickers: z.array(z.string()).min(1).max(100).describe('Массив тикеров (до 100)'),
      },
      READ_ONLY,
      async ({ tickers }) => {
        try {
          const instrumentMap = await resolveTickersToInstruments(client, tickers);
    
          const found = tickers
            .map((t) => ({ ticker: t, instrument: instrumentMap.get(t.toUpperCase()) }))
            .filter((r): r is { ticker: string; instrument: NonNullable<typeof r.instrument> } => r.instrument !== undefined);
    
          const notFound = tickers.filter((t) => !instrumentMap.has(t.toUpperCase()));
    
          if (found.length === 0) {
            return { content: [{ type: 'text' as const, text: 'Инструменты не найдены.' }] };
          }
    
          const response = await client.post<GetLastPricesResponse>(
            API_PATHS.MARKET_DATA.GET_LAST_PRICES,
            { figi: found.map((f) => f.instrument.figi) },
          );
    
          const priceMap = new Map(response.lastPrices.map((lp) => [lp.figi, lp]));
    
          const lines = found.map(({ ticker, instrument }) => {
            const lp = priceMap.get(instrument.figi);
            if (!lp) return `${ticker}: цена недоступна`;
            const price = quotationToNumber(lp.price).toFixed(2);
            return `${ticker}: ${price} (обновлено ${formatDateTime(lp.time)})`;
          });
    
          if (notFound.length > 0) {
            lines.push(`\nНе найдены: ${notFound.join(', ')}`);
          }
    
          return { content: [{ type: 'text' as const, text: lines.join('\n') }] };
        } catch (error) {
          return {
            content: [{ type: 'text' as const, text: `Ошибка: ${error instanceof Error ? error.message : String(error)}` }],
            isError: true,
          };
        }
      },
    );
  • The registration function for the "get_last_prices" tool.
    export function registerGetLastPrices(server: McpServer, client: TInvestClient): void {
Behavior3/5

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

Annotations declare readOnlyHint=true, confirming the safe read semantics implied by 'Получить' (Get). The description adds temporal context ('текущие' / current) and domain scope ('Т-Инвестициях'), but omits behavior details like cache duration, handling of invalid tickers, or rate limits that would help an agent predict outcomes.

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, no redundancy, immediately conveys the operation and scope. Efficient structure with the verb front-loaded.

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?

For a simple read tool with single parameter and no output schema, the description adequately covers the domain (T-Investments) and operation. However, absence of return value description or error behavior leaves gaps since no output schema is provided to compensate.

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 'tickers' fully documented as an array of strings (1-100 items). The description mentions 'по тикерам' (by tickers), aligning with the schema but not adding syntax, format, or example details beyond the structured definition. With complete schema coverage, baseline 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?

Specific verb+resource: 'Получить текущие рыночные цены' (Get current market prices). The temporal qualifier 'текущие' distinguishes from historical data siblings (get_candles), and domain 'Т-Инвестициях' scopes the data source. Does not explicitly name alternatives but implicitly differentiates via 'current'.

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 this versus get_order_book (which also contains price data), get_candles (historical), or get_asset_fundamentals. No mention of prerequisites (e.g., market hours) or limitations.

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