You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Use publicly accessible remote servers but have the tool calls triggered locally|**2. Streamable HTTP**|
32
+
| Use locally running Streamable HTTP servers |**2. Streamable HTTP**|
33
+
| Use any Streamable HTTP servers with non-OpenAI Responses models|**2. Streamable HTTP**|
34
+
| Work with local MCP servers that only support the standard-I/O protocol |**3. Stdio**|
35
35
36
36
## 1. Hosted MCP server tools
37
37
@@ -61,15 +61,17 @@ To stream incremental MCP results, pass `stream: true` when you run the `Agent`:
61
61
62
62
#### Optional approval flow
63
63
64
-
For sensitive operations you can require human approval of individual tool calls. Pass either `requireApproval: 'always'` or a fine‑grained object mapping tool names to `'never'`/`'always'`:
64
+
For sensitive operations you can require human approval of individual tool calls. Pass either `requireApproval: 'always'` or a fine‑grained object mapping tool names to `'never'`/`'always'`.
65
+
66
+
If you can programatically determine whether a tool call is safe, you can use the [`onApproval` callback](https://github.com/openai/openai-agents-js/blob/main/examples/mcp/hosted-mcp-on-approval.ts) to approve or reject the tool call. If you require human approval, you can use the same [human-in-the-loop (HITL) approach](/openai-agents-js/guides/human-in-the-loop/) using `interruptions` as for local function tools.
65
67
66
68
<Code
67
69
lang="typescript"
68
70
code={hostedHITLExample}
69
71
title="Human in the loop with hosted MCP tools"
70
72
/>
71
73
72
-
Fully worked samples (streaming, approval, HITL) are [examples/mcp](https://github.com/openai/openai-agents-js/tree/main/examples/mcp) in our GitHub repository.
74
+
Fully working samples (streaming, approval, HITL) are [examples/mcp](https://github.com/openai/openai-agents-js/tree/main/examples/mcp) in our GitHub repository.
0 commit comments