pub enum ResponseTool {
Show 14 variants
Function(FunctionTool),
WebSearchPreview(WebSearchPreviewTool),
WebSearch(WebSearchTool),
CodeInterpreter(CodeInterpreterTool),
Mcp(McpTool),
FileSearch(FileSearchTool),
ImageGeneration(ImageGenerationTool),
Computer,
ComputerUsePreview(ComputerUsePreviewTool),
Custom(CustomTool),
Namespace(NamespaceToolDef),
Shell(ShellTool),
ApplyPatch,
LocalShell,
}Variants§
Function(FunctionTool)
Function tool.
WebSearchPreview(WebSearchPreviewTool)
Built-in tool.
WebSearch(WebSearchTool)
Built-in non-preview hosted web search tool.
Spec: { type: "web_search" | "web_search_2025_08_26", filters? { allowed_domains? }, search_context_size?: "low"|"medium"|"high", user_location? }. Distinct from
web_search_preview — non-preview adds filters.allowed_domains and constrains
search_context_size to a typed enum.
CodeInterpreter(CodeInterpreterTool)
Built-in tool.
Mcp(McpTool)
MCP server tool.
FileSearch(FileSearchTool)
Built-in file search tool over vector stores.
ImageGeneration(ImageGenerationTool)
Built-in image generation tool. Spec:
{ type: "image_generation", action?, background?, input_fidelity?, input_image_mask?, model?, moderation?, output_compression?, output_format?, partial_images?, quality?, size? }.
Computer
Generic computer tool — { type: "computer" }.
Spec (openai-responses-api-spec.md §tools): Computer { type: "computer" }.
Carries no payload; the model is told that a computer-control surface is
available without committing to display dimensions or environment.
ComputerUsePreview(ComputerUsePreviewTool)
Computer-use preview tool — { type: "computer_use_preview", display_height, display_width, environment }.
Spec (openai-responses-api-spec.md §tools): ComputerUsePreview { display_height, display_width, environment: "browser"|"ubuntu"| "windows"|"mac", type: "computer_use_preview" }.
Custom(CustomTool)
User-defined custom tool with optional grammar-constrained input.
Spec: { name, type: "custom", defer_loading?, description?, format? }.
format constrains the model’s free-form input payload — Text is
unconstrained, Grammar enforces a Lark or regex production at decode
time. The model returns a custom_tool_call output item carrying the
raw input string back to the client; the client owns execution.
Namespace(NamespaceToolDef)
Grouping of Function / Custom tools under a shared namespace.
Spec (openai-responses-api-spec.md §tools L475):
Namespace { description, name, tools: array of Function | Custom, type: "namespace" } — inner elements share the top-level shape but
are restricted to Function or Custom. Nested namespaces and
hosted/built-in tools are explicitly not permitted as elements.
Shell(ShellTool)
Containerized shell tool. Distinct from local_shell — the tool
definition itself may carry an optional ShellEnvironment
(container-auto, local, or existing container reference) that the
platform resolves into a concrete execution target. Emitted
shell_call items use the narrower call-side unions
ShellCallEnvironment (input path) and
ResponseShellCallEnvironment (response path), which drop the
container_auto variant.
Spec (openai-responses-api-spec.md §tools, L463-470):
Shell { type: "shell", environment? }.
ApplyPatch
Built-in apply_patch tool — { type: "apply_patch" }.
Spec (openai-responses-api-spec.md §tools, L478): ApplyPatch { type: "apply_patch" }. Unit variant with no payload — the model is
simply told the apply_patch surface is available and subsequently emits
apply_patch_call items carrying file-edit operations (see
ResponseInputOutputItem::ApplyPatchCall). Pairs with
ResponsesToolChoice::ApplyPatch when callers want to force usage.
LocalShell
Built-in host-execute shell tool — { type: "local_shell" }.
Spec (openai-responses-api-spec.md §tools L462): LocalShell { type: "local_shell" } — carries no payload. Distinct from shell (T6),
which carries a containerized environment. The model emits
local_shell_call output items carrying a LocalShellExec action;
the client executes the command on the host and replies with a
matching local_shell_call_output item.
Implementations§
Trait Implementations§
Source§impl Clone for ResponseTool
impl Clone for ResponseTool
Source§fn clone(&self) -> ResponseTool
fn clone(&self) -> ResponseTool
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResponseTool
impl Debug for ResponseTool
Source§impl<'de> Deserialize<'de> for ResponseTool
impl<'de> Deserialize<'de> for ResponseTool
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ResponseTool
impl JsonSchema for ResponseTool
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read more