Skip to main content
Glama

transfer_to_agent

Transfer Bitcoin Lightning payments between AI agents or from operator to agents using the Lightning Wallet MCP server. Enables autonomous agent-to-agent transactions with spending controls.

Instructions

Transfer sats between agents or from operator to agent. REQUIRES OPERATOR KEY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_agent_idNoSource agent ID (omit to use operator balance)
to_agent_idYesDestination agent ID
amount_satsYesAmount to transfer

Implementation Reference

  • MCP tool request handler for 'transfer_to_agent' which calls the LightningFaucetClient.transferToAgent method.
    case 'transfer_to_agent': {
      const parsed = TransferToAgentSchema.parse(args);
      const result = await session.requireClient().transferToAgent(
        parsed.to_agent_id,
        parsed.amount_sats,
        parsed.from_agent_id
      );
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              message: `Transferred ${result.amountTransferred} sats`,
              amount_transferred: result.amountTransferred,
              from_balance: result.fromBalance,
              to_balance: result.toBalance,
            }, null, 2),
          },
        ],
      };
    }
  • The actual implementation of transferToAgent in the LightningFaucetClient class. It handles both operator-to-agent and agent-to-agent transfers.
    async transferToAgent(
      toAgentId: number,
      amountSats: number,
      fromAgentId?: number
    ): Promise<{
      amountTransferred: number;
      fromBalance: number;
      toBalance: number;
      rawResponse: ApiResponse;
    }> {
      // If fromAgentId is provided, it's agent-to-agent; otherwise operator-to-agent
      if (fromAgentId) {
        // This would need a new backend endpoint for agent-to-agent
        const result = await this.request<ApiResponse & {
          amount_transferred?: number;
          from_balance?: number;
          to_balance?: number;
        }>('transfer_between_agents', {
          from_agent_id: fromAgentId,
          to_agent_id: toAgentId,
          amount_sats: amountSats,
        });
    
        return {
          amountTransferred: result.amount_transferred || amountSats,
          fromBalance: result.from_balance || 0,
          toBalance: result.to_balance || 0,
          rawResponse: result,
        };
      } else {
        // Use existing fund_agent
        const result = await this.fundAgent(toAgentId, amountSats);
        return {
          amountTransferred: result.amountTransferred,
          fromBalance: result.newOperatorBalance,
          toBalance: result.newAgentBalance,
          rawResponse: result.rawResponse,
        };
      }
    }
  • Input validation schema for the 'transfer_to_agent' tool using Zod.
    const TransferToAgentSchema = z.object({
      from_agent_id: z.number().int().positive().optional().describe('Source agent ID (optional, defaults to operator balance)'),
      to_agent_id: z.number().int().positive().describe('Destination agent ID'),
      amount_sats: z.number().int().positive().describe('Amount to transfer'),
    });
  • src/index.ts:729-740 (registration)
    Registration of the 'transfer_to_agent' tool within the MCP server's tool list.
      name: 'transfer_to_agent',
      description: 'Transfer sats between agents or from operator to agent. REQUIRES OPERATOR KEY.',
      inputSchema: {
        type: 'object',
        properties: {
          from_agent_id: { type: 'integer', description: 'Source agent ID (omit to use operator balance)' },
          to_agent_id: { type: 'integer', description: 'Destination agent ID' },
          amount_sats: { type: 'integer', minimum: 1, description: 'Amount to transfer' },
        },
        required: ['to_agent_id', 'amount_sats'],
      },
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the requirement of an operator key, which is useful context for authentication. However, it lacks details on other behavioral traits such as whether the transfer is reversible, potential rate limits, error conditions, or what happens on failure, making it incomplete for a mutation tool.

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 concise with two sentences that directly state the purpose and a key requirement. It is front-loaded with the main action, and there is no unnecessary information, making it efficient. However, it could be slightly more structured by separating the requirement into a distinct note.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that this is a mutation tool with no annotations and no output schema, the description is insufficient. It lacks details on behavioral aspects like side effects, error handling, or return values, and does not fully compensate for the absence of structured data, making it incomplete for safe and effective use.

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 description coverage is 100%, meaning the input schema already documents all parameters well. The description adds minimal value by implying the 'from_agent_id' can be omitted to use operator balance, but this is also hinted in the schema. Since the schema does the heavy lifting, the baseline score of 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?

The description clearly states the action ('transfer sats') and the resources involved ('between agents or from operator to agent'), which is specific and understandable. However, it does not explicitly differentiate from sibling tools like 'fund_agent' or 'sweep_agent', which might have overlapping purposes, so it lacks full sibling distinction.

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?

The description provides some context by stating 'REQUIRES OPERATOR KEY', which implies a prerequisite for usage. However, it does not specify when to use this tool versus alternatives like 'fund_agent' or 'keysend', nor does it provide explicit exclusions or detailed guidance on scenarios, leaving usage somewhat implied.

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/lightningfaucet/lightning-wallet-mcp'

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