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.