Expand description
Utility functions for RPC server operations.
This module provides common utilities needed by the RPC server including:
- Port discovery and availability checking
- Socket address parsing with sensible defaults
- Error handling helpers for JSON-RPC responses
- Convenience functions for common error types
§Port Management
The module includes functions to find available ports automatically, starting from a preferred port (3000) and searching upward if needed.
§Error Handling
Provides helper functions to create properly formatted JSON-RPC error responses with standard error codes and descriptive messages.
Functions§
- find_
available_ port - Find an available port starting from a base port
- get_
default_ rpc_ port - Get default RPC server port (tries 3000 first, then searches)
- internal_
error - Helper to create internal error responses
- invalid_
params - Helper to create invalid params error
- is_
port_ available - Check if a port is available on localhost
- method_
not_ found - Helper to create method not found error
- parse_
socket_ addr - Parse a socket address, with sensible defaults
- to_
rpc_ error - Convert error to RPC error format