fiat_to_sats
Convert fiat currency amounts into sats for Lightning Network transactions. Use this tool to process payments by specifying the currency and amount for accurate conversion.
Instructions
Convert fiat amounts to sats
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | amount in sats | |
| currency | Yes | the fiat currency |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"amount": {
"description": "amount in sats",
"type": "number"
},
"currency": {
"description": "the fiat currency",
"type": "string"
}
},
"required": [
"currency",
"amount"
],
"type": "object"
}
Implementation Reference
- src/tools/fiat_to_sats.ts:13-24 (handler)The handler function that executes the tool: converts fiat amount to satoshis using external fiat.getSatoshiValue(params) and returns the satoshi value as text 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)Input schema defined with Zod validators for 'currency' (string) and 'amount' (number). Note: description for amount incorrectly states 'in sats'; it should be fiat amount.{ currency: z.string().describe("the fiat currency"), amount: z.number().describe("amount in sats"), },
- src/tools/fiat_to_sats.ts:6-25 (registration)Core registration of the 'fiat_to_sats' tool using server.tool(), including name, description, input schema, and handler function.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)Calls the registerFiatToSatsTool function to register the tool on the MCP server instance during initialization.registerFiatToSatsTool(this._server);