MCP Tools

Complete reference for all ClawFirst MCP tools with JSON schemas, parameters, and response formats.

Tool Overview

ClawFirst provides 6 core MCP tools for AI agent payment workflows:

Tool
Category
Purpose

x402.initialize_payment

Payment

Create payment session from agent intent

x402.authorize_transaction

Payment

Sign and submit blockchain transaction

x402.verify_settlement

Verification

Confirm transaction finality

x402.query_balance

Query

Check wallet balances

x402.estimate_fees

Query

Calculate transaction costs

x402.cancel_payment

Payment

Abort pending session

x402.initialize_payment

Initialize a new payment session for an autonomous agent transaction.

Input Schema

{
  "type": "object",
  "properties": {
    "amount": {
      "type": "string",
      "description": "Payment amount with unit (e.g., '0.1 SOL', '250 USDC')",
      "pattern": "^\\d+(\\.\\d+)?\\s+(SOL|USDC|BONK)$"
    },
    "recipient": {
      "type": "string",
      "description": "Recipient wallet address or email identifier",
      "pattern": "^[1-9A-HJ-NP-Za-km-z]{32,44}$|^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
    },
    "purpose": {
      "type": "string",
      "description": "Human-readable payment description",
      "maxLength": 500
    },
    "settlement_constraint": {
      "type": "string",
      "enum": ["immediate", "defer_until_approval", "scheduled"],
      "default": "immediate",
      "description": "Settlement timing constraint"
    },
    "idempotency_key": {
      "type": "string",
      "description": "Unique key for idempotent retries",
      "maxLength": 256
    },
    "metadata": {
      "type": "object",
      "description": "Additional context for agent audit trail",
      "additionalProperties": true
    }
  },
  "required": ["amount", "recipient"]
}

Example Request

Response

Error Responses


x402.authorize_transaction

Sign and submit a blockchain transaction for an initialized payment session.

Input Schema

Example Request

Response

Error Responses


x402.verify_settlement

Verify transaction settlement and blockchain finality status.

Input Schema

Example Request

Response

Settlement States

State
Description

pending

Transaction submitted, awaiting confirmation

confirmed

Confirmed but not yet finalized (< 32 confirmations)

finalized

Finalized with full security (≥ 32 confirmations)

failed

Transaction failed on-chain


x402.query_balance

Query agent wallet SOL and SPL token balances.

Input Schema

Example Request

Response


x402.estimate_fees

Estimate transaction fees for a potential payment.

Input Schema

Example Request

Response


x402.cancel_payment

Cancel a pending payment session before transaction authorization.

Input Schema

Example Request

Response


Error Codes Reference

Code
Description
Retry?

INSUFFICIENT_BALANCE

Agent wallet lacks funds

No - Fund wallet

APPROVAL_REQUIRED

Exceeds auto-approval threshold

No - Request approval

RATE_LIMIT_EXCEEDED

Too many tool calls

Yes - Exponential backoff

INVALID_SESSION

Session expired or not found

No - Create new session

INVALID_RECIPIENT

Malformed wallet address

No - Fix address

SESSION_EXPIRED

Payment session timed out

No - Re-initialize

TRANSACTION_FAILED

On-chain transaction failed

Maybe - Check error details

NETWORK_ERROR

Solana RPC unavailable

Yes - Retry with backoff

Best Practices

1. Idempotency Keys

Always use idempotency keys for payment operations:

2. Error Handling

Implement retry logic with exponential backoff:

3. Settlement Verification

Always verify settlement before considering payment complete:

4. Pre-flight Checks

Query balance and estimate fees before authorizing:

Next Steps

Last updated