Skip to main content
Glama
nonnname

T-Invest MCP Server

by nonnname

get_margin_attributes

Read-only

Retrieve margin account attributes like liquid portfolio value and initial margin requirements from T-Invest to manage trading positions and risk exposure.

Instructions

Получить маржинальные атрибуты счёта (ликвидный портфель, начальная маржа) из Т-Инвестиций

Input Schema

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

Implementation Reference

  • The 'get_margin_attributes' tool is registered and implemented within the registerGetUserInfo function in src/tools/get-user-info.ts. It handles the API call to GetMarginAttributes and formats the response.
    server.tool(
      'get_margin_attributes',
      'Получить маржинальные атрибуты счёта (ликвидный портфель, начальная маржа) из Т-Инвестиций',
      {
        accountId: z.string().describe('Идентификатор счёта (можно получить через get_accounts)'),
      },
      READ_ONLY,
      async ({ accountId }) => {
        try {
          const response = await client.post<GetMarginAttributesResponse>(
            API_PATHS.USERS.GET_MARGIN_ATTRIBUTES,
            { accountId },
          );
    
          const lines: string[] = [];
          if (response.liquidPortfolio) lines.push(`Ликвидный портфель: ${formatMoney(response.liquidPortfolio)}`);
          if (response.startingMargin) lines.push(`Начальная маржа: ${formatMoney(response.startingMargin)}`);
          if (response.minimalMargin) lines.push(`Минимальная маржа: ${formatMoney(response.minimalMargin)}`);
          if (response.amountOfMissingFunds) lines.push(`Дефицит средств: ${formatMoney(response.amountOfMissingFunds)}`);
          if (response.fundsSufficiencyLevel) {
            lines.push(`Уровень достаточности: ${quotationToNumber(response.fundsSufficiencyLevel).toFixed(4)}`);
          }
    
          return {
            content: [{ type: 'text' as const, text: lines.length > 0 ? lines.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 description aligns with readOnlyHint=true (uses 'Получить'/Get). It adds valuable domain context by defining what 'margin attributes' specifically includes (liquid portfolio, initial margin) and identifies the external system (T-Investments), but doesn't address error handling, rate limits, or data freshness.

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 dense sentence that front-loads the action. The parenthetical specifics (liquid portfolio, initial margin) efficiently clarify the return value. No wasted words, though slightly information-dense.

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?

Appropriately complete for a simple read-only tool with one parameter. Compensates for missing output schema by defining the semantic content of the return value (liquid portfolio, initial margin). Given the low complexity and presence of annotations, no further elaboration is necessary.

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, the schema fully documents the accountId parameter. The description doesn't add parameter-specific details beyond what's in the schema, which warrants the baseline score of 3 for high-coverage 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?

The description clearly states the action (Получить/Get) and resource (margin attributes), specifying exactly what data is returned (liquid portfolio, initial margin). It distinguishes implicitly from sibling tools like get_portfolio by focusing specifically on margin-specific metrics, though it doesn't explicitly name alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides prerequisite guidance by noting that accountId can be obtained via get_accounts. However, it lacks explicit guidance on when to use this tool versus similar siblings like get_portfolio or get_positions, and doesn't specify when not to use it.

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