fiat_to_sats
Convert fiat currency amounts to satoshis (sats) for Lightning Network transactions. Enter the currency and amount to calculate the equivalent value in sats.
Instructions
Convert fiat amounts to sats
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| currency | Yes | the fiat currency | |
| amount | Yes | amount in sats |
Implementation Reference
- src/tools/fiat_to_sats.ts:13-24 (handler)The handler function that converts the fiat amount to satoshis using the external 'fiat' library and returns the result as MCP content.async (params) => { const satoshi = await fiat.getSatoshiValue(params); return { content: [ { type: "text", text: satoshi.toString(), }, ], }; }
- src/tools/fiat_to_sats.ts:9-12 (schema)Zod schema defining input parameters: currency (string) and amount (number). Note: description for amount may be misleading as it's fiat amount to convert to sats.{ currency: z.string().describe("the fiat currency"), amount: z.number().describe("amount in sats"), },
- src/tools/fiat_to_sats.ts:6-25 (registration)The server.tool call within registerFiatToSatsTool that registers the tool with name, description, schema, and handler.server.tool( "fiat_to_sats", "Convert fiat amounts to sats", { currency: z.string().describe("the fiat currency"), amount: z.number().describe("amount in sats"), }, async (params) => { const satoshi = await fiat.getSatoshiValue(params); return { content: [ { type: "text", text: satoshi.toString(), }, ], }; } );
- src/index.ts:29-29 (registration)Invocation of registerFiatToSatsTool during server constructor to perform the tool registration.registerFiatToSatsTool(this._server);
- src/index.ts:8-8 (helper)Import of the registerFiatToSatsTool function.import { registerFiatToSatsTool } from "./tools/fiat_to_sats.js";