OpenAICloudflare Developer PlatformJul 22, 2026, 12:00 AM

Agents, Workers - Agents SDK reduces MCP schema conversion, adds exposure controls for MCP in Think and Code Mode SDK adds direct host APIs

A condensed section focused on the key takeaways first.

Original Post

Quick Digest

Summary

A condensed section focused on the key takeaways first.

openaienmodel: gpt-5-mini-2025-08-07

Agents SDK reduces MCP schema conversion; Think opt-out and Code Mode direct host APIs

Key Points

  • MCP schema conversions are cached per live connection
  • Think adds includeMcpTools opt-out for automatic MCP exposure
  • Code Mode runtime exposes search(), describe(), and execute()

Summary

MCP schema conversion is now reused while a live connection keeps the same tool catalog, avoiding repeated JSON Schema -> Zod conversions on every model turn. @cloudflare/think adds an opt-out flag includeMcpTools to stop automatic MCP tool exposure. @cloudflare/codemode exposes runtime search(), describe(), and execute() so non-AI-SDK hosts (MCP servers, Workers, etc.) can discover and invoke Code Mode connector methods directly.

Key Points

  • MCP clients cache converted input/output schemas for the duration of a live connection to reduce repeated conversion overhead.
  • Think SDK: set includeMcpTools = false (and optionally waitForMcpConnections = true) to skip Think's automatic getAITools(); listTools() still provides the raw MCP catalog; registration, restoration, discovery, direct calls, and Code Mode connectors remain supported.
  • Code Mode runtime: runtime.search(), runtime.describe(), and runtime.execute() let hosts discover protected methods (results include requiresApproval) and run code without adapting the runtime to an AI SDK; resume or resolve paused executions with approve() / reject().

Upgrade

Install the latest packages: npm i agents@latest @cloudflare/think@latest @cloudflare/codemode@latest (or use yarn/pnpm/bun equivalents).

Action Items

  • If you surface MCP tools outside Think (e.g., via Code Mode), set includeMcpTools = false to avoid double exposure.
  • Use listTools() when you only need the raw MCP catalog; use Code Mode connectors or runtime APIs for connector setup.
  • Update runtime integration to handle requiresApproval and approve()/reject() flows for protected connector methods.

Full Translation

Translations

A translation section that keeps the flow of the original article.

openaijamodel: gpt-5-mini-2025-08-07

Agents、Workers - Agents SDK が MCP スキーマ変換を削減、Think の MCP 暴露制御を追加、Code Mode SDK がホスト向け直接 API を追加

概要

2026-07-22 のリリースノートです。今回のリリースでは、Agents SDK が同じ MCP スキーマの繰り返し変換を削減し、Think による自動 MCP ツール暴露をオプトアウトする設定を追加しました。さらに、非 AI-SDK ホストが耐久的な Code Mode ランタイムを直接呼び出せるようになりました。

Think における MCP ツールの直接暴露を制御

  • Agents SDK の MCP クライアントは、ライブ接続中に同じツールカタログが維持されている限り、変換済みの入力/出力スキーマを再利用します。これにより、各モデルのターンごとに MCP の JSON Schema を Zod に再変換する必要がなくなります。

  • @cloudflare/think に includeMcpTools が追加されました。Think の自動ツールセットの外(Code Mode や別の仕組み)で MCP ツールを公開している場合は、これを false に設定してください。

    import { Think } from "@cloudflare/think" ; export class MyAgent extends Think { includeMcpTools = false ; waitForMcpConnections = true ; }

    import { Think } from "@cloudflare/think" ; export class MyAgent extends Think<Env> { includeMcpTools = false ; waitForMcpConnections = true ; }

  • この設定は Think の自動 getAITools() 呼び出しをスキップします。

  • MCP の登録、復元、ディスカバリ、未加工カタログへのアクセス、直接呼び出し、Code Mode コネクタは引き続き機能します。

  • 生の MCP カタログだけが必要な場合は listTools() を使用してください。

  • コネクタのセットアップについては「Use MCP tools with Code Mode」を参照してください。

AI SDK を使わずに Code Mode ランタイムを呼び出す

  • @cloudflare/codemode@latestexecute()search()describe() が耐久ランタイムハンドルに追加されました。これにより、MCP サーバーやその他のホストがランタイムを AI SDK のツールに適合させることなく、コードを実行したりコネクタメソッドを発見したりできます。

    const matches = await runtime.search("create issue"); const docs = await runtime.describe(matches.results[0].path); const outcome = await runtime.execute({ code: async () => github.create_issue({ title: "Bug" }) , });

  • searchdescribe の結果には、保護されたコネクタメソッドの場合 requiresApproval: true が含まれます。

  • 一時停止した実行は既存の approve()reject() で解決できます。

  • セットアップと正確なメソッド型については「Create a durable Code Mode runtime」および「Code Mode API reference」を参照してください。

アップグレード

以下のコマンドでパッケージを最新にアップグレードしてください。

  • npm: npm i agents@latest @cloudflare/think@latest @cloudflare/codemode@latest
  • yarn: yarn add agents@latest @cloudflare/think@latest @cloudflare/codemode@latest
  • pnpm: pnpm add agents@latest @cloudflare/think@latest @cloudflare/codemode@latest
  • bun: bun add agents@latest @cloudflare/think@latest @cloudflare/codemode@latest

ご不明点があれば、どの部分について詳しく知りたいか教えてください。