pub struct SomaClient { /* private fields */ }Expand description
HTTP (or other transport) client for the Soma runtime.
For application/platform servers, the lightweight local binary uses this as
an adapter to the deployed soma serve REST API. For upstream-client
servers, replace the REST envelope with the upstream service’s native API.
Implementations§
Source§impl SomaClient
impl SomaClient
Sourcepub fn new(cfg: &SomaConfig) -> Result<Self>
pub fn new(cfg: &SomaConfig) -> Result<Self>
Construct a new client from configuration.
If SOMA_API_URL is empty, Soma uses local stub responses so
tests and first-run scaffolds work without a deployed service. If it is
set, operations are forwarded to direct {SOMA_API_URL}/v1/* routes.
Sourcepub async fn greet(&self, name: Option<&str>) -> Result<Value>
pub async fn greet(&self, name: Option<&str>) -> Result<Value>
Say hello to name, or “World” if not provided.
Sourcepub async fn status(&self) -> Result<Value>
pub async fn status(&self) -> Result<Value>
Return a status snapshot of the remote service.
Note: this value is returned by the unauthenticated /status endpoint,
so it must not include secrets or sensitive topology (e.g. api_url).
CUSTOMIZE: Add non-sensitive runtime metrics (uptime, version, etc.).
Sourcepub async fn call_rest_action(
&self,
action: &str,
params: Value,
) -> Result<Value>
pub async fn call_rest_action( &self, action: &str, params: Value, ) -> Result<Value>
Call one direct REST action on a running Soma HTTP server.
This is used by remote adapter surfaces (soma <command> and eventually
stdio MCP adapter mode) so the local binary does not need local provider
manifests to execute provider-backed actions.
Sourcepub async fn provider_catalog(&self) -> Result<Value>
pub async fn provider_catalog(&self) -> Result<Value>
Fetch the live provider catalog from a deployed Soma HTTP server.
Sourcepub async fn ready(&self) -> Result<()>
pub async fn ready(&self) -> Result<()>
Readiness probe of the upstream dependency.
Stub mode is always ready (there is no upstream). Deployed mode issues a
short, timeout-bounded GET against the upstream /health so a wedged or
unreachable upstream surfaces as not-ready instead of hanging the probe.
Used by the /readyz route; keep it cheap and side-effect free.
Trait Implementations§
Source§impl Clone for SomaClient
impl Clone for SomaClient
Source§fn clone(&self) -> SomaClient
fn clone(&self) -> SomaClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more