Skip to main content

Connector

Trait Connector 

Source
pub trait Connector: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn describe<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<ConnectorDescription, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn execute<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        method: &'life1 str,
        arguments: Value,
        context: &'life2 ToolContext,
    ) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided methods
    fn revert<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _method: &'life1 str,
        _arguments: Value,
        _result: Value,
        _context: &'life2 ToolContext,
    ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn pass_ended<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _execution_id: &'life1 str,
        _status: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn execution_ended<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _execution_id: &'life1 str,
        _status: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

A transport-neutral source of sandbox-callable tools.

Required Methods§

Source

fn name(&self) -> &str

Returns the namespace this connector is bound to.

Separate from Connector::describe so a namespace can be named without being contacted. describe reaches the underlying service, so deriving the name from it meant every connector had to be connected to before any program could be built — including the ones the program never mentions.

Source

fn describe<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ConnectorDescription, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns connector metadata and schemas.

Source

fn execute<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, method: &'life1 str, arguments: Value, context: &'life2 ToolContext, ) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Executes one connector method.

Provided Methods§

Source

fn revert<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _method: &'life1 str, _arguments: Value, _result: Value, _context: &'life2 ToolContext, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Compensates a previously applied connector action.

Source

fn pass_ended<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _execution_id: &'life1 str, _status: &'life2 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Releases resources scoped to one sandbox pass.

Source

fn execution_ended<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _execution_id: &'life1 str, _status: &'life2 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Releases resources scoped to a complete execution.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§