pub struct McpExtension { /* private fields */ }Expand description
MCP Extension that provides MCP server management.
Provides:
mcpproxy tool (gateway to all configured servers)- Direct tools for servers with
directToolsenabled (optional) - Tool renderers for MCP tool calls/results
Implementations§
Source§impl McpExtension
impl McpExtension
Sourcepub fn from_cwd(cwd: &Path) -> Self
pub fn from_cwd(cwd: &Path) -> Self
Create from config loaded from disk at the given working directory.
Sourcepub async fn restore_cache(&self)
pub async fn restore_cache(&self)
Restore cached tool metadata from the on-disk cache. Should be called once at startup to prime the cache without connecting.
Sourcepub async fn bootstrap_direct_tools(&self)
pub async fn bootstrap_direct_tools(&self)
Bootstrap direct tools — checks which servers have directTools configured
but no cached metadata yet, and logs a hint. Does NOT block startup on
network connections. The first connection (via mcp({{ connect: ... }})
or mcp({{ server: ... }})) populates the cache; on subsequent startups
direct tools are available automatically.
Trait Implementations§
Source§impl Extension for McpExtension
impl Extension for McpExtension
fn name(&self) -> Cow<'static, str>
Source§fn tools(&self) -> Vec<ToolDefinition>
fn tools(&self) -> Vec<ToolDefinition>
Tools this extension provides (LLM-callable), each with its own prompt metadata.
Source§fn commands(&self) -> Vec<SlashCommand>
fn commands(&self) -> Vec<SlashCommand>
Slash commands this extension provides (e.g.
/quit, /model).
Built-in commands and extension commands use the same interface.Source§fn skills(&self) -> SkillSet
fn skills(&self) -> SkillSet
Skills this extension provides (AgentSkills-compatible).
Merged into the session’s skill set for /skill:name expansion and system prompt.
Source§fn before_compact(
&self,
_first_kept_entry_id: &str,
_tokens_before: u64,
_reason: &str,
_cancel: &Cancel,
) -> Option<BeforeCompactResult>
fn before_compact( &self, _first_kept_entry_id: &str, _tokens_before: u64, _reason: &str, _cancel: &Cancel, ) -> Option<BeforeCompactResult>
Called before compaction runs (matching pi’s
session_before_compact).
Return Some(BeforeCompactResult { cancel: true, .. }) to cancel compaction.
Return Some(BeforeCompactResult { cancel: false, summary: Some(...), .. })
to provide a custom summary instead of calling the provider.
Return None to let the default compaction proceed. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for McpExtension
impl !UnwindSafe for McpExtension
impl Freeze for McpExtension
impl Send for McpExtension
impl Sync for McpExtension
impl Unpin for McpExtension
impl UnsafeUnpin for McpExtension
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