pub struct ToolRegistry { /* private fields */ }Expand description
Request-scoped registry built from RequestPayload.tools.
Maps the name the LLM sees → routing metadata.
Implementations§
Source§impl ToolRegistry
impl ToolRegistry
Sourcepub fn build(tools: &[ResponsesTool]) -> Result<Self, ToolError>
pub fn build(tools: &[ResponsesTool]) -> Result<Self, ToolError>
Build a registry from the declared tools.
Duplicate tool names result in last-write-wins, logged at warn level.
§Errors
Returns ToolError::Config when Codex namespace member flattening
would collide with another declared tool name.
§Panics
Panics if serialization of a tool param struct fails, which cannot happen
for the types defined in this module (#[derive(Serialize)] on plain structs).
Sourcepub fn build_with_handlers(
tools: &[ResponsesTool],
handler_for: impl FnMut(ToolType) -> Option<Arc<dyn GatewayExecutor>>,
) -> Result<Self, ToolError>
pub fn build_with_handlers( tools: &[ResponsesTool], handler_for: impl FnMut(ToolType) -> Option<Arc<dyn GatewayExecutor>>, ) -> Result<Self, ToolError>
Build a registry from declared tools and attach gateway handlers for dispatchable tool types.
§Errors
Returns ToolError::Config when Codex namespace member flattening
would collide with another declared tool name.
§Panics
Panics if serialization of a tool param struct fails, which cannot happen
for the types defined in this module (#[derive(Serialize)] on plain structs).
pub fn lookup(&self, tool_name: &str) -> Option<&ToolEntry>
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn restore_final_payload_output(&self, output: &mut [OutputItem])
pub fn restore_stream_event_value(&self, value: &mut Value) -> bool
Sourcepub fn gateway_owned<'a>(
&self,
calls: &'a [FunctionToolCall],
) -> Vec<&'a FunctionToolCall>
pub fn gateway_owned<'a>( &self, calls: &'a [FunctionToolCall], ) -> Vec<&'a FunctionToolCall>
Returns the subset of calls whose names map to gateway-owned tools.
pub fn is_gateway_owned_name(&self, name: &str) -> bool
Sourcepub fn client_owned<'a>(
&self,
calls: &'a [FunctionToolCall],
) -> Vec<&'a FunctionToolCall>
pub fn client_owned<'a>( &self, calls: &'a [FunctionToolCall], ) -> Vec<&'a FunctionToolCall>
Returns the subset of calls whose names map to client-owned tools
(Function, Codex namespace members, or unknown names).
pub async fn dispatch( &self, call: &FunctionToolCall, ) -> Option<GatewayDispatchResult>
Trait Implementations§
Source§impl Debug for ToolRegistry
impl Debug for ToolRegistry
Source§impl Default for ToolRegistry
impl Default for ToolRegistry
Source§fn default() -> ToolRegistry
fn default() -> ToolRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for ToolRegistry
impl !UnwindSafe for ToolRegistry
impl Freeze for ToolRegistry
impl Send for ToolRegistry
impl Sync for ToolRegistry
impl Unpin for ToolRegistry
impl UnsafeUnpin for ToolRegistry
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 more