Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@freepilot-bot
Copy link
Contributor

Fixes #3

commit 0520423
Author: freepilot-bot [email protected]
Date: Fri Jun 20 08:00:43 2025 +0000

feat: clarify sats vs millisats units and add zod response schemas

- Updated get_balance tool description to explicitly mention millisatoshis in return value
- Added Zod schema validation for get_balance response with clear unit description
- Enhanced descriptions in make_invoice and pay_invoice tools to use 'millisatoshis (millisats)' for clarity
- Fixed fiat_to_sats tool description (input amount should be fiat, not sats)
- Added response schema validation for fiat_to_sats tool
- Updated request_invoice tool to explicitly state amount is in satoshis (sats)
- Improved AI understanding by using full unit names with common abbreviations in parentheses

This addresses the confusion between sats and millisats that AI sometimes experiences
by making units explicit throughout tool descriptions and adding proper schemas.

View job on Freepilot: https://freepilot.albylabs.com/jobs/19

- Updated get_balance tool description to explicitly mention millisatoshis in return value
- Added Zod schema validation for get_balance response with clear unit description
- Enhanced descriptions in make_invoice and pay_invoice tools to use 'millisatoshis (millisats)' for clarity
- Fixed fiat_to_sats tool description (input amount should be fiat, not sats)
- Added response schema validation for fiat_to_sats tool
- Updated request_invoice tool to explicitly state amount is in satoshis (sats)
- Improved AI understanding by using full unit names with common abbreviations in parentheses

This addresses the confusion between sats and millisats that AI sometimes experiences
by making units explicit throughout tool descriptions and adding proper schemas.
amount: z
.number()
.describe("Optional amount in millisats to pay a zero-amount invoice")
.describe("Optional amount in millisatoshis (millisats) to pay a zero-amount invoice")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: also state the fees are in millisats

import { z } from "zod";

// Define Zod schema for the response - returns number of satoshis
const FiatToSatsResponseSchema = z.number().describe("Amount in satoshis (sats)");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the right way - there should be a way to pass the response schema in as a guide, not manually validating it (I will have a look)

Copy link
Collaborator

@rolznz rolznz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK

@rolznz rolznz merged commit 6adf503 into getAlby:master Jun 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI sometimes gets mixed up between sats and millisats

2 participants