@getalby/mcp
Version:
MCP server for controlling a Lightning wallet using Nostr Wallet Connect
29 lines (28 loc) • 888 B
JavaScript
import { fiat } from "@getalby/lightning-tools";
import { z } from "zod";
export function registerFiatToSatsTool(server) {
server.registerTool("fiat_to_sats", {
title: "Fiat To Sats",
description: "Convert fiat amounts to sats",
inputSchema: {
currency: z.string().describe("the fiat currency (e.g., USD, EUR)"),
amount: z.number().describe("fiat amount to convert"),
},
outputSchema: {
satoshi: z.number().describe("Amount in sats"),
},
}, async (params) => {
const satoshi = await fiat.getSatoshiValue(params);
return {
content: [
{
type: "text",
text: JSON.stringify({ satoshi }),
},
],
structuredContent: {
satoshi,
},
};
});
}