pub struct ToolSet { /* private fields */ }Expand description
Builder that produces source-qualified tool filter strings (e.g.
"builtin:bash", "mcp:*", "custom:foo") for the session’s
available_tools list.
Tools are classified by the runtime at registration time, not from name
parsing — so add_builtin("foo") matches only tools registered as
built-in, even if an MCP server happens to register a tool with the same
wire name.
§Example
let tools = ToolSet::new()
.add_builtin_many(BUILTIN_TOOLS_ISOLATED)?
.add_mcp("*")?
.add_custom("*")?
.to_vec();Implementations§
Source§impl ToolSet
impl ToolSet
Sourcepub fn add_builtin(self, name: &str) -> Result<Self, Error>
pub fn add_builtin(self, name: &str) -> Result<Self, Error>
Add a single built-in tool pattern. Pass a specific name (e.g.
"bash") or "*" to match all built-in tools.
Sourcepub fn add_builtin_many<I, S>(self, names: I) -> Result<Self, Error>
pub fn add_builtin_many<I, S>(self, names: I) -> Result<Self, Error>
Add a list of built-in tool patterns (e.g. BUILTIN_TOOLS_ISOLATED).
Sourcepub fn add_custom(self, name: &str) -> Result<Self, Error>
pub fn add_custom(self, name: &str) -> Result<Self, Error>
Add a custom tool pattern. Matches tools registered via the SDK’s
tools option or via custom agents.
Sourcepub fn add_mcp(self, tool_name: &str) -> Result<Self, Error>
pub fn add_mcp(self, tool_name: &str) -> Result<Self, Error>
Add an MCP tool pattern. Pass the runtime’s canonical wire name
(e.g. "github-list_issues") or "*" to match all MCP tools.
Sourcepub fn to_vec(&self) -> Vec<String>
pub fn to_vec(&self) -> Vec<String>
Returns a defensive copy of the accumulated filter strings.