get_withdraw_limits
Retrieve available withdrawal limits for a T-Invest account to understand fund accessibility and plan transactions accordingly.
Instructions
Получить доступные лимиты вывода средств со счёта в Т-Инвестициях
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accountId | Yes | Идентификатор счёта (можно получить через get_accounts) |
Implementation Reference
- src/tools/get-withdraw-limits.ts:10-51 (handler)The handler logic for the 'get_withdraw_limits' tool, which fetches withdrawal limits via the TInvestClient.
server.tool( 'get_withdraw_limits', 'Получить доступные лимиты вывода средств со счёта в Т-Инвестициях', { accountId: z.string().describe('Идентификатор счёта (можно получить через get_accounts)'), }, READ_ONLY, async ({ accountId }) => { try { const response = await client.post<GetWithdrawLimitsResponse>( API_PATHS.OPERATIONS.GET_WITHDRAW_LIMITS, { accountId }, ); const lines: string[] = []; if (response.money && response.money.length > 0) { lines.push('Доступно к выводу:'); for (const m of response.money) lines.push(` ${formatMoney(m)}`); } if (response.blocked && response.blocked.length > 0) { lines.push('\nЗаблокировано:'); for (const m of response.blocked) lines.push(` ${formatMoney(m)}`); } if (response.blockedGuarantee && response.blockedGuarantee.length > 0) { lines.push('\nЗаблокировано под гарантийное обеспечение:'); for (const m of response.blockedGuarantee) lines.push(` ${formatMoney(m)}`); } 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, }; } }, ); - src/tools/get-withdraw-limits.ts:9-52 (registration)The registration function that defines the 'get_withdraw_limits' tool on the McpServer.
export function registerGetWithdrawLimits(server: McpServer, client: TInvestClient): void { server.tool( 'get_withdraw_limits', 'Получить доступные лимиты вывода средств со счёта в Т-Инвестициях', { accountId: z.string().describe('Идентификатор счёта (можно получить через get_accounts)'), }, READ_ONLY, async ({ accountId }) => { try { const response = await client.post<GetWithdrawLimitsResponse>( API_PATHS.OPERATIONS.GET_WITHDRAW_LIMITS, { accountId }, ); const lines: string[] = []; if (response.money && response.money.length > 0) { lines.push('Доступно к выводу:'); for (const m of response.money) lines.push(` ${formatMoney(m)}`); } if (response.blocked && response.blocked.length > 0) { lines.push('\nЗаблокировано:'); for (const m of response.blocked) lines.push(` ${formatMoney(m)}`); } if (response.blockedGuarantee && response.blockedGuarantee.length > 0) { lines.push('\nЗаблокировано под гарантийное обеспечение:'); for (const m of response.blockedGuarantee) lines.push(` ${formatMoney(m)}`); } 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, }; } }, ); }