ExMCP.Reliability (ex_mcp v0.10.0)
View SourceConvenience functions for reliability features.
This module provides easy access to reliability patterns without manual setup.
Examples
# Wrap a function with retry logic
ExMCP.Reliability.with_retry(fn ->
ExMCP.Client.call_tool(client, "risky_tool", %{})
end)
# Create a circuit-breaker protected function
protected_call = ExMCP.Reliability.protect(fn ->
external_service_call()
end, failure_threshold: 5)
# Use the protected function
protected_call.()
Summary
Functions
Creates a circuit breaker and retry-protected version of a function.
Functions
Creates a circuit breaker and retry-protected version of a function.
The function will be protected by a circuit breaker and retried according to the specified options on failure.
Options
:name- Name for the circuit breaker process:failure_threshold- Number of failures before circuit opens (default: 5):success_threshold- Number of successes to close circuit (default: 2):timeout- Timeout for each call (default: 5000):reset_timeout- Time before attempting to close open circuit (default: 30000)- Plus all retry options from
ExMCP.Reliability.Retry.mcp_defaults/1