Skip to content

Module BSV::MCP::Tools::Helpers

Shared helpers used across multiple MCP tools.

Public Class Methods

error_response(message)

Build a standard MCP error response. - @param message [String] error description - @return [MCP::Tool::Response]

input_to_h(input, _index)

Convert a TransactionInput to a hash. - @api private

output_to_h(output, index)

Convert a TransactionOutput to a hash. - @api private

resolve_network_sym(network_arg, server_context)

Resolve a network string to the SDK symbol (:mainnet or :testnet).

Checks the per-call network_arg first, then falls back to the server-level config in server_context, then defaults to :mainnet. - @param network_arg [String, nil] per-call override ('mainnet'/'testnet') - @param server_context [Hash, nil] server context with :bsv_network key - @return [Symbol] :mainnet or :testnet

transaction_to_h(tx)

Convert a Transaction to a hash suitable for JSON responses. - @param tx [BSV::Transaction::Transaction] - @return [Hash]

utxo_to_h(utxo)

Convert a UTXO to a hash. - @api private