概要
公開日: 2026-07-13
翻訳生成に失敗したため、原文をそのまま保存しています。
原文
Changelog New updates and improvements at Cloudflare. Subscribe to RSS View RSS feeds ← Back to all posts Agents can respond to MCP elicitation requests Jul 13, 2026 Agents Workers Agents connected to Model Context Protocol (MCP) servers with addMcpServer can now handle elicitation ↗ requests. Elicitation lets an MCP server request user input while it handles a tool call. Form mode collects structured, non-sensitive data. URL mode asks for consent before opening an out-of-band flow, such as third-party authorization or payment. sequenceDiagram participant User participant Agent as Agent (MCP client) participant Server as MCP server participant Browser Server->>Agent: elicitation/create Agent->>User: Show server, reason, and input or URL User->>Agent: Submit, open, decline, or cancel Agent->>Browser: Open URL after consent (URL mode) Agent->>Server: accept, decline, or cancel Server-->>Agent: Optional URL completion notification Register a handler for each mode your Agent supports in onStart() : JavaScript TypeScript JavaScript import { Agent } from "agents" ; export class MyAgent extends Agent { onStart () { this . mcp . configureElicitationHandlers ( { form : ( request , serverId ) => this . forwardToUser ( request , serverId ) , url : ( request , serverId ) => this . forwardToUser ( request , serverId ) , } ) ; } forwardToUser ( request , serverId ) { // Show the request in your UI and resolve after the user responds. throw new Error ( Implement elicitation for ${ serverId } : ${ request . params . message } , ) ; } } this.forwardToUser(request, serverId), url: (request, serverId) => this.forwardToUser(request, serverId), }); } forwardToUser(request, serverId) { // Show the request in your UI and resolve after the user responds. throw new Error( `Implement elicitation for ${serverId}: ${request.params.message}`, ); }}"> TypeScript import { Agent } from "agents" ; import type { ElicitRequest , ElicitResult } from "agents/mcp" ; export class MyAgent extends Agent < Env > { onStart () { this . mcp . configureElicitationHandlers ( { form : ( request , serverId ) => this . forwardToUser ( request , serverId ) , url : ( request , serverId ) => this . forwardToUser ( request , serverId ) , } ) ; } private forwardToUser ( request : ElicitRequest , serverId : string , ) : Promise < ElicitResult > { // Show the request in your UI and resolve after the user responds. throw new Error ( Implement elicitation for ${ serverId } : ${ request . params . message } , ) ; } } { onStart() { this.mcp.configureElicitationHandlers({ form: (request, serverId) => this.forwardToUser(request, serverId), url: (request, serverId) => this.forwardToUser(request, serverId), }); } private forwardToUser( request: ElicitRequest, serverId: string, ): Promise { // Show the request in your UI and resolve after the user responds. throw new Error( `Implement elicitation for ${serverId}: ${request.params.message}`, ); }}"> Connections advertise only the modes with configured handlers. An Agent without handlers advertises no elicitation capability, which lets the server use its fallback. The SDK stores the advertised modes with each MCP server registration so they survive Durable Object hibernation. Callback functions remain in memory and reattach when onStart() runs. For implementation details and a browser forwarding pattern, refer to MCP client elicitation . The mcp-client ↗ and mcp-elicitation ↗ examples implement both sides. Upgrade To update to this release: npm yarn pnpm bun npm i agents@latest yarn add agents@latest pnpm add agents@latest bun add agents@latest Resources API New to Cloudflare? Directory Sponsorships Open Source Cloudflare Research Support Help Center System Status Compliance GDPR Company cloudflare.com Our team Careers Tools Cloudflare Radar Cloudflare Labs Speed Test Is BGP Safe Yet? Certificate Transparency Community Community forum X Discord YouTube GitHub © 2026 Cloudflare, In