Skip to main content
Glama
lnfi-network

RGB Lightning Network MCP Server

by lnfi-network

rgb_decode_lightning_invoice

Decode RGB Lightning invoices to extract payment details and transaction information for RGB asset transfers on the Lightning Network.

Instructions

Decode an RGB Lightning invoice

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
invoiceYesThe RGB Lightning invoice to decode

Implementation Reference

  • src/server.ts:303-318 (registration)
    Registers the 'rgb_decode_lightning_invoice' MCP tool with input schema, description, and inline handler function that calls the RGB client wrapper.
    server.tool(
      'rgb_decode_lightning_invoice',
      'Decode an RGB Lightning invoice',
      {
        invoice: z.string().describe('The RGB Lightning invoice to decode'),
      },
      async ({ invoice }) => {
        try {
          const result = await rgbClient.decodeRGBLNInvoice(invoice);
          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 };
        }
      }
    );
  • The inline MCP tool handler executing the decoding logic via rgbClient and formatting the response as MCP content.
    async ({ invoice }) => {
      try {
        const result = await rgbClient.decodeRGBLNInvoice(invoice);
        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 };
      }
    }
  • Zod input schema defining the 'invoice' parameter for the tool.
    {
      invoice: z.string().describe('The RGB Lightning invoice to decode'),
  • Helper wrapper method in RGBApiClientWrapper that proxies the decode call to the underlying RGB API SDK lightning module.
    async decodeRGBLNInvoice(invoice: string) {
      return await this.client.lightning.decodeRGBLNInvoice(invoice);
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It states what the tool does ('Decode') but doesn't describe the decoding process, output format, error handling, or any side effects (e.g., network calls, validation). For a tool with no annotation coverage, this is inadequate, as it leaves critical behavioral traits unspecified.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence with zero wasted words, making it highly concise and front-loaded. It immediately conveys the core function without unnecessary elaboration, which is efficient for an agent's quick comprehension. Every word earns its place by stating the essential action and target.

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 the tool's complexity (involving decoding of a specialized invoice format), lack of annotations, and no output schema, the description is insufficiently complete. It doesn't explain what decoding returns (e.g., structured data, validation result), potential errors, or how it integrates with sibling tools like payment or creation. For a tool with no structured output documentation, more descriptive context is needed.

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?

The input schema has 100% description coverage, with the 'invoice' parameter clearly documented as 'The RGB Lightning invoice to decode'. The description adds no additional semantic context beyond this, such as invoice format examples or validation rules. Given the high schema coverage, a baseline score of 3 is appropriate, as the schema does the heavy lifting without description enhancement.

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 verb ('Decode') and the resource ('RGB Lightning invoice'), making the purpose immediately understandable. It distinguishes this tool from siblings like 'rgb_pay_lightning_invoice' or 'rgb_create_lightning_invoice' by focusing on decoding rather than creation or payment. However, it doesn't specify what decoding entails (e.g., extracting payment details, validating structure), which prevents a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a valid invoice), contrast with similar tools like 'rgb_check_indexer_url' for validation, or indicate scenarios where decoding is necessary (e.g., before payment or for auditing). This lack of context leaves the agent to infer usage from the tool name alone.

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

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