Skip to main content

EnvoyAdapter

Trait EnvoyAdapter 

Source
pub trait EnvoyAdapter: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn tier(&self) -> Tier;
    fn flavor(&self) -> AdapterFlavor;
    fn supported_verb_ids(&self) -> Vec<&'static str>;
    fn dispatch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        verb_id: &'life1 str,
        input: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Provider adapter — what the host registers to expose a vendor’s verbs.

Each adapter declares which verb ids it supports and accepts dispatch calls with raw JSON input/output. The host (R409-T9) is responsible for validating the input against the verb’s schemars-derived schema before calling EnvoyAdapter::dispatch; the adapter only needs to handle shape errors caused by adapter-side translation (e.g. a location string the adapter doesn’t recognise).

Why untyped JSON at the trait boundary instead of typed associated types: an adapter typically supports several unrelated verbs (Hetzner implements cloud.vps.create, cloud.vps.destroy, cloud.vps.status). A single trait that fans out over verb ids keeps registration uniform — the host stores Vec<Arc<dyn EnvoyAdapter>> and routes by id rather than juggling per-verb generic parameters. Adapter-side, the typed translation lives in private methods (see HetznerEnvoy) where the JSON is decoded once into V::Input and re-encoded from V::Output.

Required Methods§

Source

fn id(&self) -> &str

Stable provider id, e.g. "hetzner". Used for tool-namespace composition (mcp__yah__envoy__hetzner__<verb>) and for matching against .yah/envoys/<id>/.

Source

fn tier(&self) -> Tier

Tier this adapter is registered at.

Source

fn flavor(&self) -> AdapterFlavor

How the adapter is built.

Source

fn supported_verb_ids(&self) -> Vec<&'static str>

Verb ids this adapter supports. The host calls this once at registration time; per W144 D2 the result becomes the adapter’s “supported_verbs” claim in its manifest.

Source

fn dispatch<'life0, 'life1, 'async_trait>( &'life0 self, verb_id: &'life1 str, input: Value, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Dispatch one verb call. verb_id is one of the entries in Self::supported_verb_ids; input is the raw JSON request body. Returns the verb’s response body as JSON.

Unsupported ids should return Err — they are a programmer error (the host shouldn’t dispatch unsupported verbs), not a runtime vendor failure.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§