pub struct ToolServer { /* private fields */ }Expand description
Builder for constructing a ToolServerHandle.
Accumulates tools and configuration, then produces a shared handle via
run().
Implementations§
Source§impl ToolServer
impl ToolServer
pub fn new() -> Self
Sourcepub fn tool(self, tool: impl Tool + 'static) -> Self
pub fn tool(self, tool: impl Tool + 'static) -> Self
Add a static tool to the agent. Re-registering an existing name replaces the implementation (last wins) and keeps its position.
Sourcepub fn dynamic_tool(self, tool: DynamicTool) -> Self
pub fn dynamic_tool(self, tool: DynamicTool) -> Self
Add a runtime-defined tool. Re-registering an existing name replaces the implementation and keeps its position.
Sourcepub fn portable_dynamic_tool(self, tool: PortableDynamicTool) -> Self
pub fn portable_dynamic_tool(self, tool: PortableDynamicTool) -> Self
Add a context-free dynamic tool through the classic registry adapter.
Sourcepub fn rmcp_tool(self, tool: Tool, client: ServerSink) -> Self
Available on crate feature rmcp only.
pub fn rmcp_tool(self, tool: Tool, client: ServerSink) -> Self
rmcp only.Add an MCP tool (from rmcp) to the agent, bounded by
DEFAULT_MCP_TOOL_TIMEOUT
(see issue #1914). Use rmcp_tool_with_timeout
to change or disable it.
Sourcepub fn rmcp_tool_with_timeout(
self,
tool: Tool,
client: ServerSink,
timeout: impl Into<Option<Duration>>,
) -> Self
Available on crate feature rmcp only.
pub fn rmcp_tool_with_timeout( self, tool: Tool, client: ServerSink, timeout: impl Into<Option<Duration>>, ) -> Self
rmcp only.Add an MCP tool (from rmcp) with a per-call timeout (see issue #1914).
Pass a Duration to bound the call, or None to
disable the timeout (unbounded).
Sourcepub fn retrieved_tools(
self,
sample: usize,
index: impl VectorStoreIndexDyn + Send + Sync + 'static,
toolset: ToolSet,
) -> Self
pub fn retrieved_tools( self, sample: usize, index: impl VectorStoreIndexDyn + Send + Sync + 'static, toolset: ToolSet, ) -> Self
Configure tools retrieved from a vector index for each prompt.
Sourcepub fn run(self) -> ToolServerHandle
pub fn run(self) -> ToolServerHandle
Consume the builder and return a shared ToolServerHandle.