pub struct McpPluginFactory { /* private fields */ }Expand description
Plugin factory for MCP. Add once to LashCoreBuilder via
.plugin(Arc::new(factory)).
Implementations§
Source§impl McpPluginFactory
impl McpPluginFactory
Sourcepub async fn new(
servers: BTreeMap<String, McpServerConfig>,
) -> Result<Self, McpError>
pub async fn new( servers: BTreeMap<String, McpServerConfig>, ) -> Result<Self, McpError>
Connect to every configured server eagerly and return a factory whose
pool is ready to use. The pool is Arc-shared across sessions; cloning
the factory and adding it to multiple LashCores shares the same
connections.
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Empty pool — useful when servers are added at runtime via
McpPluginFactory::attach_server.
Sourcepub fn pool(&self) -> &Arc<McpConnectionPool>
pub fn pool(&self) -> &Arc<McpConnectionPool>
Direct access to the underlying pool, in case the embedder wants to inspect or mutate it directly.
Sourcepub async fn attach_server(
&self,
server_name: String,
config: McpServerConfig,
) -> Result<(), McpError>
pub async fn attach_server( &self, server_name: String, config: McpServerConfig, ) -> Result<(), McpError>
Attach a new server at runtime. The new tools become visible to any session created after this call returns; existing sessions will see the new tools after their next tool-surface refresh.
Trait Implementations§
Source§impl PluginFactory for McpPluginFactory
impl PluginFactory for McpPluginFactory
fn id(&self) -> &'static str
Source§fn build(
&self,
_ctx: &PluginSessionContext,
) -> Result<Arc<dyn SessionPlugin>, PluginError>
fn build( &self, _ctx: &PluginSessionContext, ) -> Result<Arc<dyn SessionPlugin>, PluginError>
Produce a session-scoped plugin. Must be cheap — see the
trait-level docs for the full contract.
fn lashlang_abilities(&self) -> LashlangAbilities
fn lashlang_language_features(&self) -> LashlangLanguageFeatures
Source§fn lashlang_resources(&self) -> ResourceCatalog
fn lashlang_resources(&self) -> ResourceCatalog
Host-owned Lashlang catalog entries that code may link against. Read more
Auto Trait Implementations§
impl Freeze for McpPluginFactory
impl RefUnwindSafe for McpPluginFactory
impl Send for McpPluginFactory
impl Sync for McpPluginFactory
impl Unpin for McpPluginFactory
impl UnsafeUnpin for McpPluginFactory
impl UnwindSafe for McpPluginFactory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more