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 async fn build_with_handlers(
tools: &mut [ResponsesTool],
executors: &mut GatewayExecutors,
) -> Result<Self, ToolError>
pub async fn build_with_handlers( tools: &mut [ResponsesTool], executors: &mut GatewayExecutors, ) -> 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, when discovered MCP
tools derive the same internal model-visible name, or when an MCP
declaration is itself invalid (for example, a request tries to
override a gateway-configured server’s connection). Transient MCP
discovery failures (the server could not be reached) are not
returned as errors; they are recorded as failed McpListTools
metadata so the rest of the request can proceed.
§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 contains_mcp_server_label(&self, server_label: &str) -> bool
pub fn restore_final_payload_output(&self, output: &mut [OutputItem])
pub fn restore_stream_event_wire(&self, wire: &mut WireEvent) -> 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