From dc0335d79825e55eb3b75ec9bfa316010f4e944b Mon Sep 17 00:00:00 2001 From: Rohan Mehta Date: Wed, 21 May 2025 18:31:20 -0400 Subject: [PATCH] docs: add new MCP server and tools --- docs/ja/mcp.md | 9 +++++---- docs/ja/tools.md | 4 ++++ docs/mcp.md | 5 +++-- docs/tools.md | 4 ++++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/ja/mcp.md b/docs/ja/mcp.md index 7cdaa57e..09804beb 100644 --- a/docs/ja/mcp.md +++ b/docs/ja/mcp.md @@ -12,12 +12,13 @@ Agents SDK は MCP をサポートしており、これにより幅広い MCP ## MCP サーバー -現在、MCP 仕様では使用するトランスポート方式に基づき 2 種類のサーバーが定義されています。 +現在、MCP 仕様では使用するトランスポート方式に基づき 3 種類のサーバーが定義されています。 -1. **stdio** サーバー: アプリケーションのサブプロセスとして実行されます。ローカルで動かすイメージです。 +1. **stdio** サーバー: アプリケーションのサブプロセスとして実行されます。ローカルで動かすイメージです。 2. **HTTP over SSE** サーバー: リモートで動作し、 URL 経由で接続します。 +3. **Streamable HTTP** サーバー: MCP 仕様に定義された Streamable HTTP トランスポートを使用してリモートで動作します。 -これらのサーバーへは [`MCPServerStdio`][agents.mcp.server.MCPServerStdio] と [`MCPServerSse`][agents.mcp.server.MCPServerSse] クラスを使用して接続できます。 +これらのサーバーへは [`MCPServerStdio`][agents.mcp.server.MCPServerStdio]、[`MCPServerSse`][agents.mcp.server.MCPServerSse]、[`MCPServerStreamableHttp`][agents.mcp.server.MCPServerStreamableHttp] クラスを使用して接続できます。 たとえば、[公式 MCP filesystem サーバー](https://www.npmjs.com/package/@modelcontextprotocol/server-filesystem)を利用する場合は次のようになります。 @@ -46,7 +47,7 @@ agent=Agent( ## キャッシュ -エージェントが実行されるたびに、MCP サーバーへ `list_tools()` が呼び出されます。サーバーがリモートの場合は特にレイテンシが発生します。ツール一覧を自動でキャッシュしたい場合は、[`MCPServerStdio`][agents.mcp.server.MCPServerStdio] と [`MCPServerSse`][agents.mcp.server.MCPServerSse] の両方に `cache_tools_list=True` を渡してください。ツール一覧が変更されないと確信できる場合のみ使用してください。 +エージェントが実行されるたびに、MCP サーバーへ `list_tools()` が呼び出されます。サーバーがリモートの場合は特にレイテンシが発生します。ツール一覧を自動でキャッシュしたい場合は、[`MCPServerStdio`][agents.mcp.server.MCPServerStdio]、[`MCPServerSse`][agents.mcp.server.MCPServerSse]、[`MCPServerStreamableHttp`][agents.mcp.server.MCPServerStreamableHttp] の各クラスに `cache_tools_list=True` を渡してください。ツール一覧が変更されないと確信できる場合のみ使用してください。 キャッシュを無効化したい場合は、サーバーで `invalidate_tools_cache()` を呼び出します。 diff --git a/docs/ja/tools.md b/docs/ja/tools.md index 7ab15e47..cd80092d 100644 --- a/docs/ja/tools.md +++ b/docs/ja/tools.md @@ -17,6 +17,10 @@ OpenAI は [`OpenAIResponsesModel`][agents.models.openai_responses.OpenAIRespons - [`WebSearchTool`][agents.tool.WebSearchTool] はエージェントに Web 検索を行わせます。 - [`FileSearchTool`][agents.tool.FileSearchTool] は OpenAI ベクトルストアから情報を取得します。 - [`ComputerTool`][agents.tool.ComputerTool] はコンピュータ操作タスクを自動化します。 +- [`CodeInterpreterTool`][agents.tool.CodeInterpreterTool] はサンドボックス環境でコードを実行します。 +- [`HostedMCPTool`][agents.tool.HostedMCPTool] はリモート MCP サーバーのツールをモデルから直接利用できるようにします。 +- [`ImageGenerationTool`][agents.tool.ImageGenerationTool] はプロンプトから画像を生成します。 +- [`LocalShellTool`][agents.tool.LocalShellTool] はローカルマシンでシェルコマンドを実行します。 ```python from agents import Agent, FileSearchTool, Runner, WebSearchTool diff --git a/docs/mcp.md b/docs/mcp.md index e279a25e..2cd0aad9 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -12,8 +12,9 @@ Currently, the MCP spec defines two kinds of servers, based on the transport mec 1. **stdio** servers run as a subprocess of your application. You can think of them as running "locally". 2. **HTTP over SSE** servers run remotely. You connect to them via a URL. +3. **Streamable HTTP** servers run remotely using the Streamable HTTP transport defined in the MCP spec. -You can use the [`MCPServerStdio`][agents.mcp.server.MCPServerStdio] and [`MCPServerSse`][agents.mcp.server.MCPServerSse] classes to connect to these servers. +You can use the [`MCPServerStdio`][agents.mcp.server.MCPServerStdio], [`MCPServerSse`][agents.mcp.server.MCPServerSse], and [`MCPServerStreamableHttp`][agents.mcp.server.MCPServerStreamableHttp] classes to connect to these servers. For example, this is how you'd use the [official MCP filesystem server](https://www.npmjs.com/package/@modelcontextprotocol/server-filesystem). @@ -42,7 +43,7 @@ agent=Agent( ## Caching -Every time an Agent runs, it calls `list_tools()` on the MCP server. This can be a latency hit, especially if the server is a remote server. To automatically cache the list of tools, you can pass `cache_tools_list=True` to both [`MCPServerStdio`][agents.mcp.server.MCPServerStdio] and [`MCPServerSse`][agents.mcp.server.MCPServerSse]. You should only do this if you're certain the tool list will not change. +Every time an Agent runs, it calls `list_tools()` on the MCP server. This can be a latency hit, especially if the server is a remote server. To automatically cache the list of tools, you can pass `cache_tools_list=True` to [`MCPServerStdio`][agents.mcp.server.MCPServerStdio], [`MCPServerSse`][agents.mcp.server.MCPServerSse], and [`MCPServerStreamableHttp`][agents.mcp.server.MCPServerStreamableHttp]. You should only do this if you're certain the tool list will not change. If you want to invalidate the cache, you can call `invalidate_tools_cache()` on the servers. diff --git a/docs/tools.md b/docs/tools.md index 5fe2eced..89e28d99 100644 --- a/docs/tools.md +++ b/docs/tools.md @@ -13,6 +13,10 @@ OpenAI offers a few built-in tools when using the [`OpenAIResponsesModel`][agent - The [`WebSearchTool`][agents.tool.WebSearchTool] lets an agent search the web. - The [`FileSearchTool`][agents.tool.FileSearchTool] allows retrieving information from your OpenAI Vector Stores. - The [`ComputerTool`][agents.tool.ComputerTool] allows automating computer use tasks. +- The [`CodeInterpreterTool`][agents.tool.CodeInterpreterTool] lets the LLM execute code in a sandboxed environment. +- The [`HostedMCPTool`][agents.tool.HostedMCPTool] exposes a remote MCP server's tools to the model. +- The [`ImageGenerationTool`][agents.tool.ImageGenerationTool] generates images from a prompt. +- The [`LocalShellTool`][agents.tool.LocalShellTool] runs shell commands on your machine. ```python from agents import Agent, FileSearchTool, Runner, WebSearchTool