{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tools": [
      {
        "name": "quote_channel_open",
        "description": "Get a price quote for opening a Lightning channel. FREE — no payment required. Pricing-only mode: pass just capacity_sat for a detailed price breakdown. Workflow mode: include peer_pubkey, mode, and idempotency_key to initiate the full channel-open flow (PROVIDER_FUNDED or COOP_5050).",
        "inputSchema": {
          "type": "object",
          "properties": {
            "capacity_sat": {
              "type": "integer",
              "description": "Desired channel capacity in satoshis.",
              "minimum": 20000
            },
            "node_pubkey": {
              "type": "string",
              "description": "Optional 66-char hex Lightning node public key.",
              "pattern": "^[0-9a-fA-F]{66}$"
            },
            "private": {
              "type": "boolean",
              "description": "Whether the channel should be private (default false)."
            },
            "target_confirmations": {
              "type": "integer",
              "description": "Target number of on-chain confirmations (1-144).",
              "minimum": 1,
              "maximum": 144
            },
            "memo": {
              "type": "string",
              "description": "Optional memo for the quote."
            },
            "peer_pubkey": {
              "type": "string",
              "description": "66-char hex peer pubkey (workflow mode — requires mode and idempotency_key).",
              "pattern": "^[0-9a-fA-F]{66}$"
            },
            "peer_addr": {
              "type": "string",
              "description": "Optional host:port of the peer node (workflow mode)."
            },
            "mode": {
              "type": "string",
              "enum": ["PROVIDER_FUNDED", "COOP_5050"],
              "description": "Channel funding mode (workflow mode). PROVIDER_FUNDED: we fund fully, customer gets inbound. COOP_5050: economic 50/50 via push_sat."
            },
            "idempotency_key": {
              "type": "string",
              "description": "Unique key for workflow mode (1-128 chars).",
              "pattern": "^[a-zA-Z0-9_-]{1,128}$"
            }
          },
          "required": ["capacity_sat"]
        }
      },
      {
        "name": "create_open_invoice",
        "description": "Create a Lightning invoice for a previously quoted channel open. Returns a BOLT11 payment request and expiry timestamp.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "request_id": {
              "type": "string",
              "description": "UUID of the quote request."
            }
          },
          "required": ["request_id"]
        }
      },
      {
        "name": "verify_payment",
        "description": "Verify that the Lightning invoice for a channel open has been paid. Checks with LND that the invoice is settled.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "request_id": {
              "type": "string",
              "description": "UUID of the invoiced request."
            },
            "payment_hash": {
              "type": "string",
              "description": "Optional payment hash (hex). Defaults to the stored invoice hash."
            }
          },
          "required": ["request_id"]
        }
      },
      {
        "name": "open_channel",
        "description": "Open the Lightning channel after payment is verified. Connects to the peer and opens the channel on-chain.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "request_id": {
              "type": "string",
              "description": "UUID of the paid request."
            }
          },
          "required": ["request_id"]
        }
      },
      {
        "name": "get_request_status",
        "description": "Get the current status of a channel open request. Returns the full state machine state and any channel info.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "request_id": {
              "type": "string",
              "description": "UUID of the request to check."
            }
          },
          "required": ["request_id"]
        }
      },
      {
        "name": "request_coop_open",
        "description": "Request a cooperative 50/50 channel open. Since true dual-funding is generally unavailable in LND, this uses 'economic 50/50': provider opens channel fully funded and pushes ~50% to remote via push_sat. Returns a plan with capacity, contributions, limitations, and fees.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "peer_pubkey": {
              "type": "string",
              "description": "66-char hex Lightning node public key.",
              "pattern": "^[0-9a-fA-F]{66}$"
            },
            "peer_addr": {
              "type": "string",
              "description": "Optional host:port of the peer."
            },
            "total_capacity_sat": {
              "type": "integer",
              "description": "Total desired channel capacity in sats.",
              "minimum": 20000
            },
            "idempotency_key": {
              "type": "string",
              "description": "Unique idempotency key.",
              "pattern": "^[a-zA-Z0-9_-]{1,128}$"
            }
          },
          "required": ["peer_pubkey", "total_capacity_sat", "idempotency_key"]
        }
      },
      {
        "name": "list_limits",
        "description": "List the effective rate limits and channel policy for your API key. Includes daily limits, pending limits, and current usage.",
        "inputSchema": {
          "type": "object",
          "properties": {}
        }
      },
      {
        "name": "healthcheck",
        "description": "Check server and LND health status.",
        "inputSchema": {
          "type": "object",
          "properties": {}
        }
      },
      {
        "name": "confirm_tool_payment",
        "description": "Confirm that a per-tool pricing invoice has been paid. Pass the payment_hash from the PAYMENT_REQUIRED response. On success, an access grant is created and the tool can be called.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "payment_hash": {
              "type": "string",
              "description": "The payment_hash (hex) from the 402 PAYMENT_REQUIRED response. Call this after paying the invoice to activate tool access."
            }
          },
          "required": ["payment_hash"]
        }
      },
      {
        "name": "get_tool_pricing",
        "description": "Get pricing information for a specific tool. Returns price, access type, and whether you have an active grant.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "tool_name": {
              "type": "string",
              "description": "Name of the tool to get pricing info for."
            }
          },
          "required": ["tool_name"]
        }
      },
      {
        "name": "register_api_key",
        "description": "Register a new API key for agent communication. FREE — no X-Api-Key required. Returns an API key that can be used in X-Api-Key header for all other tools. Email must be unique. Rate-limited per IP (5 keys/24h).",
        "inputSchema": {
          "type": "object",
          "properties": {
            "request_id": {
              "type": "string",
              "description": "Optional UUID for idempotency. If reused, returns the original record."
            },
            "name": {
              "type": "string",
              "description": "Display name for the API key owner (1-80 chars, no control characters).",
              "minLength": 1,
              "maxLength": 80
            },
            "email": {
              "type": "string",
              "description": "Email address (must be unique; no disposable domains).",
              "format": "email",
              "maxLength": 320
            },
            "notes": {
              "type": "string",
              "description": "Optional notes (max 500 chars, no control characters).",
              "maxLength": 500
            },
            "purpose": {
              "type": "string",
              "description": "Optional description of intended use (max 80 chars, no control characters).",
              "maxLength": 80
            }
          },
          "required": ["name", "email"]
        }
      },
      {
        "name": "create_invoice",
        "description": "Create a Lightning invoice through the server. PAID — requires L402 auth. Accepts amount_sat OR amount_msat (not both). Returns a BOLT11 payment request.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "request_id": {
              "type": "string",
              "description": "UUID for idempotency."
            },
            "amount_sat": {
              "type": "integer",
              "description": "Invoice amount in satoshis. Provide this OR amount_msat, not both.",
              "minimum": 1
            },
            "amount_msat": {
              "type": "integer",
              "description": "Invoice amount in millisatoshis. Provide this OR amount_sat, not both.",
              "minimum": 1000
            },
            "memo": {
              "type": "string",
              "description": "Optional memo for the invoice (max 200 chars).",
              "maxLength": 200
            },
            "expiry_sec": {
              "type": "integer",
              "description": "Invoice expiry in seconds (default 3600, min 60, max 604800).",
              "minimum": 60,
              "maximum": 604800
            },
            "private": {
              "type": "boolean",
              "description": "Whether to include private route hints (default false)."
            }
          },
          "required": ["request_id"]
        }
      }
    ]
  }
}
