The @langchain/openai package provides built-in tools for the OpenAI Responses API via the tools export, plus the legacy DallEAPIWrapper class and a customTool helper.
import { ChatOpenAI, tools, DallEAPIWrapper, customTool } from "@langchain/openai";
Server tools are hosted by OpenAI — no execute callback needed.
| Tool | Function | Description |
|---|---|---|
| Web Search | tools.webSearch() |
Search the web for up-to-date information. Supports domain filtering, user location, and configurable context size. |
| MCP | tools.mcp() |
Connect to remote MCP servers or OpenAI service connectors (Dropbox, Gmail, Google Calendar, Google Drive, Microsoft Teams, Outlook, SharePoint). |
| Code Interpreter | tools.codeInterpreter() |
Write and run Python code in a sandboxed container. Useful for data analysis, file generation, and visualization. |
| File Search | tools.fileSearch() |
Semantic and keyword search across uploaded files in vector stores. Supports metadata filtering and ranking. |
| Image Generation | tools.imageGeneration() |
Generate or edit images using text prompts with configurable size, quality, format, and background. |
Dynamic tools require an execute callback — your code handles execution while the model provides instructions.
| Tool | Function | Model | Description |
|---|---|---|---|
| Computer Use | tools.computerUse() |
computer-use-preview |
Control computer interfaces via mouse clicks, keyboard input, scrolling, and screenshots. |
| Shell | tools.shell() |
gpt-5.1 |
Execute shell commands with concurrent command support, timeout, and output limits. |
| Local Shell | tools.localShell() |
codex-mini-latest |
Execute shell commands locally, designed for Codex CLI workflows. |
| Apply Patch | tools.applyPatch() |
gpt-5.1 |
Apply structured diffs to create, update, or delete files for iterative code editing. |
DallEAPIWrapper is a class-based tool for generating images with DALL-E 2 or 3. For new projects, consider using tools.imageGeneration() instead.
The customTool() helper creates tools compatible with OpenAI's Custom Tool format for the Responses API.
An interface for the Dall-E API Wrapper.
Options for the OpenAI web search tool.
Domain filtering configuration for web search.
Options for connecting to a remote MCP server via URL.
Options for connecting to an OpenAI-maintained service connector.
Filter object to specify which tools are allowed.
Filter object for approval requirements.
Options for the Code Interpreter tool.
Auto container configuration for Code Interpreter.
Options for the File Search tool.
A filter used to compare a specified attribute key to a given value.
Combine multiple filters using and or or.
Ranking options for file search results.
Options for the Image Generation tool.
Optional mask for inpainting. Allows you to specify areas of the image
Options for the Computer Use tool.
Input structure for the Computer Use tool.
Options for the Local Shell tool.
Options for the Shell tool.
Result of executing shell commands.
Options for the Apply Patch tool.