Skip to main content
Glama
botwallet-co

BotWallet MCP Server

botwallet_pay

Send payments to merchants or bots using USDC on Solana. Specify recipient and amount for direct payments, or use a payment request ID for paylinks. Payments complete immediately within spending limits or require owner approval for larger amounts.

Instructions

Make a payment to a merchant or bot. Specify to + amount for direct payments, or payment_request_id to pay a specific paylink. If the payment is within your guard rails, it completes immediately via FROST threshold signing and returns your new balance. If it requires owner approval, returns needs_approval: true with a transaction_id — check botwallet_events for the approval result, then call botwallet_confirm_payment. Always call botwallet_can_i_afford first if unsure about your balance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toNoRecipient username (required unless using payment_request_id)
amountNoAmount in USD (required unless using payment_request_id)
payment_request_idNoPay a specific paylink by ID (alternative to to+amount)
noteNoNote visible to recipient
referenceNoYour internal reference for tracking
idempotency_keyNoUnique key to prevent duplicate payments on retry. Auto-generated if omitted.

Implementation Reference

  • The definition and handler implementation for the 'botwallet_pay' tool. It handles payment creation, potential approval flows, and optional FROST threshold signing for transaction completion.
    const pay: ToolDefinition = {
      name: 'botwallet_pay',
      description:
        'Make a payment to a merchant or bot. Specify `to` + `amount` for direct payments, ' +
        'or `payment_request_id` to pay a specific paylink. ' +
        'If the payment is within your guard rails, it completes immediately via FROST threshold signing ' +
        'and returns your new balance. If it requires owner approval, returns `needs_approval: true` ' +
        'with a `transaction_id` — check botwallet_events for the approval result, then call ' +
        'botwallet_confirm_payment. Always call botwallet_can_i_afford first if unsure about your balance.',
      inputSchema: z.object({
        to: UsernameSchema.optional().describe('Recipient username (required unless using payment_request_id)'),
        amount: AmountSchema.optional().describe('Amount in USD (required unless using payment_request_id)'),
        payment_request_id: z.string().optional()
          .describe('Pay a specific paylink by ID (alternative to to+amount)'),
        note: z.string().max(500).optional()
          .describe('Note visible to recipient'),
        reference: z.string().max(100).optional()
          .describe('Your internal reference for tracking'),
        idempotency_key: z.string().optional()
          .describe('Unique key to prevent duplicate payments on retry. Auto-generated if omitted.'),
      }),
      async handler(args, ctx) {
        try {
          const { to, amount, payment_request_id, note, reference, idempotency_key } = args as {
            to?: string; amount?: number; payment_request_id?: string;
            note?: string; reference?: string; idempotency_key?: string;
          };
    
          const idemKey = idempotency_key || randomUUID();
          const payResult = await ctx.sdk.pay({ to, amount, payment_request_id, note, reference }, idemKey);
    
          // If needs approval, return immediately — no signing needed
          if ('needs_approval' in payResult && payResult.needs_approval) {
            return formatResult({
              needs_approval: true,
              approval_id: payResult.approval_id,
              reason: payResult.reason,
              message: payResult.message,
              approval_url: payResult.approval_url,
              next_steps: 'Check botwallet_events for approval result, then call botwallet_confirm_payment.',
            });
          }
    
          // Already completed (custodial or server-signed)
          if ('paid' in payResult && payResult.paid) {
            return formatResult(payResult);
          }
    
          // Pre-approved with transaction_id: confirm → get Solana tx → FROST sign
          const result = payResult as Record<string, unknown>;
          if (result.transaction_id) {
            if (!ctx.config.hasSeed || !ctx.config.walletName) {
              return noSeedError('complete payment (FROST signing)');
            }
    
            const txId = result.transaction_id as string;
            const confirmResult = await ctx.sdk.confirmPayment({
              transaction_id: txId,
            });
            if (!confirmResult.message) {
              return formatToolError(new Error(
                'Transaction may have expired or already been completed. Check status with botwallet_list_payments.'
              ));
            }
    
            const mnemonic = loadSeed(ctx.config.walletName);
            const signResult = await frostSignAndSubmit(
              ctx.sdk,
              mnemonic,
              txId,
              confirmResult.message,
            );
    
            return formatResult({
              paid: true,
              ...signResult,
            });
          }
    
          return formatToolError(new Error(
            'Unexpected payment response from server. Check status with botwallet_list_payments or botwallet_events.'
          ));
        } catch (e) {
          return formatToolError(e);
        }
      },
    };
Behavior4/5

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

With no annotations, the description carries full burden and does well by disclosing key behaviors: immediate completion via FROST threshold signing within guard rails, owner approval requirements returning 'needs_approval: true', and the need to check botwallet_events and call botwallet_confirm_payment for approvals. It lacks details on error handling or rate limits, but covers critical operational aspects.

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?

The description is appropriately sized and front-loaded, with the first sentence stating the purpose clearly. Each subsequent sentence adds necessary context without redundancy, though it could be slightly more streamlined in the middle section about approval flows.

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?

Given the complexity of a payment tool with no annotations or output schema, the description is quite complete. It covers purpose, usage guidelines, behavioral outcomes, and parameter semantics. It could benefit from mentioning error cases or return value details, but it provides sufficient context for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds value by explaining the semantic relationship between parameters: 'Specify `to` + `amount` for direct payments, or `payment_request_id` to pay a specific paylink,' clarifying the alternative usage patterns beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Make a payment') and target ('to a merchant or bot'), distinguishing it from sibling tools like botwallet_balance or botwallet_create_paylink. It specifies the core functionality with specific verbs and resources.

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

Usage Guidelines5/5

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

Explicit guidance is provided: 'Always call botwallet_can_i_afford first if unsure about your balance,' and it references alternatives like botwallet_events and botwallet_confirm_payment for follow-up actions. It clearly differentiates when to use this tool versus others in the workflow.

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/botwallet-co/mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server