跳到主内容
@wquguru
精选78Cloudflare Agents SDK(Changelog)AI 编程与模型

Cloudflare Agents SDK 优化 MCP 转换

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

原文
发到 X

This release reduces repeated MCP schema conversion and adds an opt-out for Think's automatic MCP tool exposure. It also lets non-AI-SDK hosts invoke the durable Code Mode runtime directly.

Control direct MCP tool exposure in Think

Agents SDK MCP clients now reuse converted input and output schemas while a live connection keeps the same tool catalog. This avoids converting every MCP JSON Schema to Zod again for each model turn.

@cloudflare/think also adds includeMcpTools. Set it to false when you expose MCP tools through Code Mode or another mechanism outside Think's automatic tool set:

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

This setting skips Think's automatic getAITools() call. MCP registration, restoration, discovery, raw catalog access, direct calls, and Code Mode connectors continue to work.

Use listTools() when you only need the raw MCP catalog. For connector setup, refer to Use MCP tools with Code Mode.

Invoke the Code Mode runtime without the AI SDK

@cloudflare/codemode@latest adds execute(), search(), and describe() to the durable runtime handle. MCP servers and other hosts can now execute code and discover connector methods without adapting the runtime to an AI SDK tool.

代码 · 5
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" })`,
});
代码 · 5
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" })`,
});

Search and describe results include requiresApproval: true for protected connector methods. Resolve a paused execution with the existing approve() and reject() methods.

For setup and exact method types, refer to Create a durable Code Mode runtime and the Code Mode API reference.

Upgrade

npmyarnpnpmbun

代码 · 1
npm i agents@latest @cloudflare/think@latest @cloudflare/codemode@latest
代码 · 1
yarn add agents@latest @cloudflare/think@latest @cloudflare/codemode@latest
代码 · 1
pnpm add agents@latest @cloudflare/think@latest @cloudflare/codemode@latest
代码 · 1
bun add agents@latest @cloudflare/think@latest @cloudflare/codemode@latest

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

相似阅读

另一事件,读法相近