Skip to main content
Glama
lnfi-network

RGB Lightning Network MCP Server

by lnfi-network

rgb_create_swap

Create asset swaps on the RGB Lightning Network to exchange digital assets using specified swap parameters for peer-to-peer transactions.

Instructions

Create a new asset swap

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
swapParamsYesSwap parameters object

Implementation Reference

  • src/server.ts:252-267 (registration)
    Registration of the 'rgb_create_swap' tool, including input schema (loose passthrough object) and inline handler that calls rgbClient.createSwap(swapParams) and returns JSON result.
    server.tool(
      'rgb_create_swap',
      'Create a new asset swap',
      {
        swapParams: z.object({}).passthrough().describe('Swap parameters object'),
      },
      async ({ swapParams }) => {
        try {
          const result = await rgbClient.createSwap(swapParams);
          return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
        } catch (error) {
          const errorMessage = error instanceof Error ? error.message : String(error);
          return { content: [{ type: 'text', text: `Error: ${errorMessage}` }], isError: true };
        }
      }
    );
  • Helper wrapper method in RGBApiClientWrapper that delegates the swap creation to the underlying RgbApiClient SDK's swaps.createSwap method.
    async createSwap(swapParams: any) {
      return await this.client.swaps.createSwap(swapParams);
    }
  • Type definition for swap parameters (loose object type). Note: the zod schema in registration is also loose.
    export interface SwapParams {
      [key: string]: any;
    }

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/lnfi-network/rgb-mcp-server'

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