Built-in server-side tools for OpenAI models deployed in Azure AI Foundry.
These tool classes represent server-side capabilities (web search, code
execution, image generation, etc.) that models can invoke within a single
conversational turn. All classes inherit from :class:BuiltinTool (which
itself inherits from :class:dict) so they can be passed directly to
model.bind_tools() without extra conversion.
Each class is a thin wrapper around the corresponding
OpenAI SDK <https://github.com/openai/openai-python>_ TypedDict from
:mod:openai.types.responses, so the parameter types and available options
always stay in sync with the API.
Available tools:
CodeInterpreterTool – run Python code in a sandboxed containerWebSearchTool – search the internetFileSearchTool – semantic search over uploaded vector storesImageGenerationTool – generate or edit imagesMcpTool – call tools on a remote MCP serverCommonly needed SDK types are re-exported here for convenience:
FileSearchFilters – filter type for :class:FileSearchToolImageGenerationInputImageMask – mask type for :class:ImageGenerationToolMcpAllowedTools – allowed-tools type for :class:McpToolMcpRequireApproval – approval type for :class:McpToolRankingOptions – ranking-options type for :class:FileSearchToolUserLocation – user-location type for :class:WebSearchToolWebSearchFilters – filters type for :class:WebSearchToolExample::
from langchain.chat_models import init_chat_model
from langchain_azure_ai.tools.builtin import CodeInterpreterTool
from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()
model = init_chat_model(model="azure_ai:gpt-4.1", credential=credential)
model_with_code = model.bind_tools([CodeInterpreterTool()])
response = model_with_code.invoke("Use Python to tell me a joke")