@getalby/mcp
Version:
MCP server for controlling a Lightning wallet using Nostr Wallet Connect
34 lines (33 loc) • 1.13 kB
JavaScript
import { z } from "zod";
import { transactionSchema } from "./schemas/transaction.js";
export function registerLookupInvoiceTool(server, client) {
server.registerTool("lookup_invoice", {
title: "Lookup Invoice",
description: "Look up lightning invoice details from a BOLT-11 invoice or payment hash",
inputSchema: {
payment_hash: z
.string()
.describe("The payment hash of the invoice to look up")
.nullish(),
invoice: z
.string()
.describe("The BOLT 11 invoice to look up")
.nullish(),
},
outputSchema: transactionSchema,
}, async (params) => {
const result = await client.lookupInvoice({
invoice: params.invoice || undefined,
payment_hash: params.payment_hash || undefined,
});
return {
content: [
{
type: "text",
text: JSON.stringify(result, null, 2),
},
],
structuredContent: result,
};
});
}