botwallet_can_i_afford
Check if you have sufficient balance for a payment by showing fees, total cost, and remaining balance, and identify approval requirements before proceeding.
Instructions
Pre-flight check before paying. Shows the fee, total cost, and your balance after payment. Also warns if the payment requires owner approval or exceeds limits. Always call this before botwallet_pay if unsure about your balance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Recipient username | |
| amount | Yes | Amount in USD |
Implementation Reference
- src/tools/spending.ts:39-47 (handler)The handler for botwallet_can_i_afford which executes the affordability check via the SDK.
async handler(args, ctx) { try { const { to, amount } = args as { to: string; amount: number }; const result = await ctx.sdk.canIAfford({ to, amount }); return formatResult(result); } catch (e) { return formatToolError(e); } }, - src/tools/spending.ts:35-38 (schema)Input schema definition for botwallet_can_i_afford.
inputSchema: z.object({ to: UsernameSchema.describe('Recipient username'), amount: AmountSchema.describe('Amount in USD'), }), - src/tools/spending.ts:222-222 (registration)Tool registration for botwallet_can_i_afford inside the spendingTools array.
canIAfford,