pub struct ToolRegistration { /* private fields */ }Implementations§
Source§impl ToolRegistration
impl ToolRegistration
pub fn with_network_access(self, access: ToolNetworkAccess) -> Self
pub fn new( name: impl Into<Arc<str>>, capability: CapabilityLevel, uses_pty: bool, executor: ToolExecutorFn, ) -> Self
pub fn from_tool( name: impl Into<Arc<str>>, capability: CapabilityLevel, tool: Arc<dyn Tool>, ) -> Self
pub fn from_tool_with_metadata( name: impl Into<Arc<str>>, capability: CapabilityLevel, tool: Arc<dyn Tool>, metadata: ToolRegistrationSpec, ) -> Self
pub fn from_tool_instance<T>(
name: impl Into<Arc<str>>,
capability: CapabilityLevel,
tool: T,
) -> Selfwhere
T: Tool + 'static,
Sourcepub fn from_cgp_tool<Ctx>(
name: impl Into<Arc<str>>,
capability: CapabilityLevel,
facade: ToolFacade<Ctx>,
) -> Selfwhere
ToolFacade<Ctx>: Tool + 'static,
pub fn from_cgp_tool<Ctx>(
name: impl Into<Arc<str>>,
capability: CapabilityLevel,
facade: ToolFacade<Ctx>,
) -> Selfwhere
ToolFacade<Ctx>: Tool + 'static,
Register a tool wrapped with a CGP runtime context.
Wraps an existing Arc<dyn Tool> in a CGP ToolFacade with the
specified runtime context’s approval, metadata, sandbox, logging,
cache, and retry providers.
Prefer wrap_native_tool_interactive() or wrap_native_tool_ci() when
the caller still owns the concrete tool instance. Use this bridge when the
tool already has genuine shared ownership.
§Example
use vtcode_core::components::{InteractiveCtx, ToolBridgeCtx, wrap_tool_interactive};
let tool: Arc<dyn Tool> = Arc::new(MyTool);
let reg = ToolRegistration::from_cgp_tool(
"my_tool",
CapabilityLevel::Basic,
wrap_tool_interactive(tool, workspace_root),
);pub fn with_llm_visibility(self, expose: bool) -> Self
pub fn with_catalog_source(self, catalog_source: ToolCatalogSource) -> Self
pub fn with_pty(self, uses_pty: bool) -> Self
pub fn with_deprecated(self, deprecated: bool) -> Self
pub fn with_deprecation_message(self, message: impl Into<String>) -> Self
pub fn with_cgp_wrapped(self, wrapped: bool) -> Self
pub fn with_handler(self, handler: ToolHandler) -> Self
pub fn with_native_cgp_factory(self, factory: NativeCgpToolFactory) -> Self
pub fn name(&self) -> &str
Sourcepub fn capability(&self) -> CapabilityLevel
pub fn capability(&self) -> CapabilityLevel
Returns the capability level of this tool.
Sourcepub fn catalog_source(&self) -> ToolCatalogSource
pub fn catalog_source(&self) -> ToolCatalogSource
Returns the catalog source of this tool.
Sourcepub fn expose_in_llm(&self) -> bool
pub fn expose_in_llm(&self) -> bool
Returns whether this tool is visible to the LLM.
Sourcepub fn is_deprecated(&self) -> bool
pub fn is_deprecated(&self) -> bool
Returns whether this tool is deprecated.
Sourcepub fn deprecation_message(&self) -> Option<&str>
pub fn deprecation_message(&self) -> Option<&str>
Returns the deprecation message if this tool is deprecated.
Sourcepub fn is_cgp_wrapped(&self) -> bool
pub fn is_cgp_wrapped(&self) -> bool
Returns whether this tool is CGP-wrapped.
Sourcepub fn handler(&self) -> ToolHandler
pub fn handler(&self) -> ToolHandler
Returns the tool handler implementation.
Sourcepub fn native_cgp_factory(&self) -> Option<NativeCgpToolFactory>
pub fn native_cgp_factory(&self) -> Option<NativeCgpToolFactory>
Returns the native CGP factory if set.
Sourcepub fn metadata(&self) -> &ToolRegistrationSpec
pub fn metadata(&self) -> &ToolRegistrationSpec
Returns a reference to the tool registration metadata.
Sourcepub fn parameter_schema(&self) -> Option<&Value>
pub fn parameter_schema(&self) -> Option<&Value>
Returns the parameter JSON schema (delegates to metadata).
Sourcepub fn config_schema(&self) -> Option<&Value>
pub fn config_schema(&self) -> Option<&Value>
Returns the configuration JSON schema (delegates to metadata).
Sourcepub fn state_schema(&self) -> Option<&Value>
pub fn state_schema(&self) -> Option<&Value>
Returns the state JSON schema (delegates to metadata).
Sourcepub fn prompt_path(&self) -> Option<&str>
pub fn prompt_path(&self) -> Option<&str>
Returns the prompt file path (delegates to metadata).
Sourcepub fn default_permission(&self) -> Option<ToolPolicy>
pub fn default_permission(&self) -> Option<ToolPolicy>
Returns the default permission policy (delegates to metadata).
Sourcepub fn with_metadata(self, metadata: ToolRegistrationSpec) -> Self
pub fn with_metadata(self, metadata: ToolRegistrationSpec) -> Self
Replaces the tool registration metadata.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Sets the tool description (delegates to metadata).
Sourcepub fn with_prompt_path(self, path: impl Into<String>) -> Self
pub fn with_prompt_path(self, path: impl Into<String>) -> Self
Sets the prompt file path (delegates to metadata).
Sourcepub fn with_parameter_schema(self, schema: Value) -> Self
pub fn with_parameter_schema(self, schema: Value) -> Self
Sets the parameter JSON schema (delegates to metadata).
Sourcepub fn with_config_schema(self, schema: Value) -> Self
pub fn with_config_schema(self, schema: Value) -> Self
Sets the configuration JSON schema (delegates to metadata).
Sourcepub fn with_state_schema(self, schema: Value) -> Self
pub fn with_state_schema(self, schema: Value) -> Self
Sets the state JSON schema (delegates to metadata).
Sourcepub fn with_permission(self, permission: ToolPolicy) -> Self
pub fn with_permission(self, permission: ToolPolicy) -> Self
Sets the default permission policy (delegates to metadata).
Sourcepub fn with_allowlist(
self,
patterns: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_allowlist( self, patterns: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Adds glob patterns to the allowlist (delegates to metadata).
Sourcepub fn with_denylist(
self,
patterns: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_denylist( self, patterns: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Adds glob patterns to the denylist (delegates to metadata).
Sourcepub fn with_aliases(
self,
aliases: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_aliases( self, aliases: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Adds alternative names for the tool (delegates to metadata).
Sourcepub fn with_server_hint(self, hint: impl Into<String>) -> Self
pub fn with_server_hint(self, hint: impl Into<String>) -> Self
Sets the MCP server hint (delegates to metadata).
Sourcepub fn with_behavior(self, behavior: ToolBehavior) -> Self
pub fn with_behavior(self, behavior: ToolBehavior) -> Self
Sets the tool behavior classification (delegates to metadata).
Trait Implementations§
Source§impl Clone for ToolRegistration
impl Clone for ToolRegistration
Auto Trait Implementations§
impl !RefUnwindSafe for ToolRegistration
impl !UnwindSafe for ToolRegistration
impl Freeze for ToolRegistration
impl Send for ToolRegistration
impl Sync for ToolRegistration
impl Unpin for ToolRegistration
impl UnsafeUnpin for ToolRegistration
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
impl<T> CacheValue for T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more