Skip to main content
Glama
baskcart

W3 Ledger MCP Server

by baskcart

purchase_product

Debit buyer balance and credit merchant for product purchases using dual signatures to authorize transactions on the W3 Ledger.

Instructions

Purchase a product by debiting the sender's DAH balance and crediting the receiver (merchant). Requires dual signatures.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sender_public_keyYesPublic key of the buyer.
receiver_public_keyYesPublic key of the merchant receiving payment.
orderDetailsYesOrder information.
sender_signatureYesBuyer's transaction signature.
receiver_signatureYesMerchant's co-signature for dual signing.
timestampYesISO 8601 timestamp.

Implementation Reference

  • The execution handler for the 'purchase_product' tool, which makes a POST request to the '/product-purchase' endpoint.
    case 'purchase_product': {
        const res = await client.post('/product-purchase', args);
        return toResult(res.data, !res.ok);
    }
  • The schema definition for the 'purchase_product' tool, defining the required inputs like public keys, order details, and signatures.
    {
        name: 'purchase_product',
        description:
            'Purchase a product by debiting the sender\'s DAH balance and crediting ' +
            'the receiver (merchant). Requires dual signatures.',
        inputSchema: {
            type: 'object',
            properties: {
                sender_public_key: {
                    type: 'string',
                    description: 'Public key of the buyer.',
                },
                receiver_public_key: {
                    type: 'string',
                    description: 'Public key of the merchant receiving payment.',
                },
                orderDetails: {
                    type: 'object',
                    description: 'Order information.',
                    properties: {
                        totalAmount: {
                            type: 'number',
                            description: 'Total purchase amount.',
                            minimum: 0.01,
                        },
                        orderNumber: {
                            type: 'string',
                            description: 'Unique order number.',
                        },
                    },
                    required: ['totalAmount', 'orderNumber'],
                },
                sender_signature: {
                    type: 'string',
                    description: 'Buyer\'s transaction signature.',
                },
                receiver_signature: {
                    type: 'string',
                    description: 'Merchant\'s co-signature for dual signing.',
                },
                timestamp: {
                    type: 'string',
                    description: 'ISO 8601 timestamp.',
                },
            },
            required: [
                'sender_public_key',
                'receiver_public_key',
                'orderDetails',
                'sender_signature',
                'receiver_signature',
                'timestamp',
            ],
        },
        access: 'write',
    },
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. Discloses critical auth requirement (dual signatures) and economic mechanism (balance transfer), but omits reversibility, error conditions (insufficient funds), return value structure, and idempotency expectations for this financial mutation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two efficient sentences with zero waste. Front-loaded with action verb, mechanism explanation follows immediately. No redundant filler despite covering complex financial operation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Minimum viable for a 6-parameter financial transaction tool. With no output schema and no annotations, the description covers core functionality but should ideally address success indicators, failure modes (insufficient balance), or transaction finality given the monetary stakes.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, establishing baseline 3. Description adds semantic value by mapping sender→buyer and receiver→merchant, and explicitly connecting the 'dual signatures' requirement to the sender_signature and receiver_signature parameters, clarifying their relational purpose.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Specific verb ('Purchase') + resource ('product') + mechanism ('debiting sender's DAH balance and crediting receiver'). Clearly distinguishes from siblings like check_balance (read-only lookup) and create/claim_gift_card (card management vs direct purchase).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implies usage through mechanism description (debit/credit flow) and prerequisite ('Requires dual signatures'), but lacks explicit when-to-use guidance versus alternatives like claim_gift_card or when purchasing is preferable to other payment methods in the sibling set.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/baskcart/w3ledger-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server