OpenAI Agents SDK tools: function tools, hosted tools and MCP, with a working sketch
The OpenAI Agents SDK gives an agent 3 main kinds of tool. Here is how each works, and how to hand the agent an inbox, a phone number and a browser it can use for real.
- Function toolsYour own codeThe agentcallsYour functionrunsAny API
- Hosted toolsOpenAI’s serversThe agentcallsOpenAI hosts itruns onWeb, files, code
- MCP serversAnother serviceThe agentconnects toMCP serverlistsIts tools
- Real-world toolsObsessionThe agentcallsInbox, number, browserreachesAny company
The SDK decides how the agent calls a tool. What the tool reaches in the world is up to you.
The OpenAI Agents SDK gives an agent tools in 3 main ways: function tools that wrap your own code, hosted tools that run on OpenAI’s servers, and MCP servers that expose another service’s tools. To give an agent real-world tools such as an inbox or a phone number, wrap each call in a function tool, or connect a server that offers them.
On this page
A tool is something an agent can do besides write text. The OpenAI Agents SDK, in Python and JavaScript, runs a loop: the model reads the task, may call a tool, reads what the tool returned, and repeats until it has an answer. Tool calling is that loop. Most of the work in a useful agent is choosing its tools, and that choice decides what the agent can touch outside the conversation.
The tools are described here from OpenAI’s own documentation, read on 23 November 2026. The SDK moves fast, so check the linked pages for the version you install.
The kinds of tool in the SDK
The Python tools guide and the JavaScript tools guide group tools into categories. The 3 that matter first are these:
- Function tools. You wrap a function of your own. In Python the SDK reads the name, description and input shape from the function, its type annotations and its docstring. In JavaScript you give the tool a name, a description, a parameters schema (a Zod schema, which also checks the model’s arguments) and an execute function.
- Hosted tools. These run on OpenAI’s servers beside the model, and the Python page lists web search, file search, code interpreter, image generation and hosted MCP among them. They need the Responses model, and you configure them without writing the tool.
- MCP servers. The Model Context Protocol (MCP) is the standard way an agent connects to another service’s tools. The SDK can attach a server you run or reach, and a hosted option lets OpenAI call a publicly reachable server for you.
There are others: agents exposed as tools, so one agent can call another without handing the conversation over, and tools that run in your own environment, such as shell and computer use. The 3 above cover most agents that act on other companies and people.
Function tools: wrap your own code
A function tool is the most flexible kind, because anything you can call from code becomes something the agent can do. Describe it clearly: the model picks a tool by its name and description, so a vague description produces wrong calls. Keep each tool small, returning a short result the model can read.
The JavaScript SDK’s pattern, as its documentation describes the options, is:
- Define the tool. Call tool() from the @openai/agents package with a name (“lookup_order”), a description (“Find an order by its number and return its status.”), a parameters schema written in Zod, here a single orderNumber string, and an execute function that returns the answer as text.
- Hand it to an agent. Create an Agent with a name, instructions (“Answer order questions with the tools you have.”) and the tool in its tools list.
- Run it. Call run(agent, "Where is order 4471?"). The model calls lookup_order with the number, reads what it returns, and writes the answer in finalOutput.
Check the import names against the version you install, as the JavaScript guide is the reference. Two habits help. Validate inputs, because a model can pass the wrong shape. And return a plain sentence or a small object on failure, so the agent can decide what to try next.
Hosted tools and MCP servers
Hosted tools save you writing a tool for common jobs. Web search and code execution run on OpenAI’s side, so there is no server of yours in the path. The trade is that you choose from what OpenAI offers, on the model the page says each needs.
The Python MCP guide sets out the options. A hosted MCP tool is added to the agent’s tools, and OpenAI’s Responses API calls a publicly reachable server for you. Streamable HTTP servers, and local servers over standard input and output, are passed to the agent as MCP servers, and the SDK connects while your code runs. The page advises keeping access tokens in the authorisation header, not the address, and connecting only to servers you trust.
The choice between a function tool and an MCP server is mostly about who maintains the tool. With a function tool you write and own it. With MCP, the service publishes its tools and you connect. AI agent tools versus MCP goes through the trade.
Giving the agent real-world tools
The tools above reach the web and your own systems. An agent that acts as a customer, a buyer or a support rep needs more: an email address that receives the confirmation link, a phone number that receives the 6-digit code, and a browser that stays signed in. These are the pieces most agents lack, and each is one more vendor if you buy them separately.
Obsession is the toolkit for AI agents: phone numbers, inboxes, browsers and sandboxes on one API and one bill. Its developers page shows each as one call, and the sketch below wraps one as a function tool, using the call names the page gives:
- Create the client and the inbox. Build new Obsession({ apiKey: process.env.OBSESSION_API_KEY }), then call obsession.inboxes.create() once. The inbox has its own address, inbox.address.
- Wrap sending as a function tool. Make a tool named “send_email” with a Zod schema for to, subject and text. Its execute function calls inbox.send({ to, subject, text }) and returns “Sent from” the inbox address.
- Give it to the agent. An Agent named “Booking agent”, with the instruction “Book tables by email from your own address.” and send_email in its tools list.
- Run it. run(agent, "Ask bookings@larkfield.example for 2 at 19:30 on Friday.") sends the email from the agent’s own address.
The reply does not come back through the tool. Each new email reaches your webhook as email.received, so your code passes it to the agent as the next turn. A number works the same way: obsession.numbers.create({ country: "US" }) gives the agent a number, number.sms sends a text, and each text back arrives as sms.received.
One agent, one identity, every piece the job needs
Wrapping 3 vendors as 3 sets of function tools works. The cost shows up at the seams: the code arrives by text at one vendor while the browser waits at another, and the email thread and the call log live in different places. Obsession puts the pieces under one persona: obsession.personas.create({ inbox: true, phone: "US", browser: true }) gives the agent an inbox, a number and a browser as one identity, free while it waits.
- The inbox: email for agents sends and receives, keeps threads and attachments, and reads codes and links out of each email. An inbox is $0.50 a month.
- The number: a phone number sends and receives texts and takes calls, through the voice agent you bring or connect. A US number is $2 a month and a text $0.015.
- The browser: a cloud browser keeps its logins between runs, so the agent signs in once and stays signed in.
- The event log: every email, text and page lands in one log, dated, so you can see why the agent did what it did.
If your agent needs one piece, one specialist is enough, and the best email API for AI agents compares 7. AgentMail, Twilio, Browserbase and E2B, or every piece on one API sets 4 vendors beside one. Obsession’s MCP server gives the same calls as tools to any MCP client, and the infrastructure stack shows where each piece sits. Teams who don’t code can run a blueprint such as the Inbox agent instead. With its own number and browser, the same agent can also confirm appointments by text, chase a supplier’s quote or check a competitor’s sign-up, from one agent to ten thousand.
Questions about OpenAI Agents SDK tools
Function tools that wrap your own code, hosted tools such as web search, file search and code interpreter that run on OpenAI’s servers, MCP servers, agents exposed as tools, and tools that run in your own environment such as shell and computer use.
The model reads the task and may ask to call a tool by name with arguments. The SDK runs it, passes the result back to the model, and repeats until the model gives a final answer. Clear names and descriptions decide whether it picks the right tool.
In Python, wrap a function and the SDK reads its name, description and inputs from the function and its annotations. In JavaScript, call tool() with a name, a description, a Zod parameters schema and an execute function, then list it in the agent’s tools.
Yes. A hosted MCP tool lets OpenAI’s Responses API call a publicly reachable server, and the SDK can also connect to a Streamable HTTP server or a local one and pass it to the agent. Keep access tokens in the header and connect only to servers you trust.
AI agent tools versus MCPWrap a call that creates an inbox or number as a function tool, or connect a server that offers them. With Obsession, obsession.inboxes.create() gives the agent an address and obsession.numbers.create gives it a number, and replies reach your webhook as events.
See the API and MCPNo. The Python documentation says hosted tools need the OpenAI Responses model. Function tools work with any model the SDK supports.
Sources
In the order the article cites them. Every link was checked on 23 Nov 2026.