[Client] Support cancellation and per-call deadlines in Client::callTool()
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start at Client::callTool() and trace the STDIO, legacy HTTP, and HTTP 2026-07-28 transport paths it uses. Check how interruption is handled around synchronous I/O and suspended requests. Done means per-call cancellation and deadlines work across the described transports, interrupted results and pending state are cleared, the connection remains usable, and notification failures do not replace the original interruption.
由索引模型根据 Issue 内容生成。
描述
Client::callTool() does not accept a cancellation signal or a per-call timeout. Applications cannot abandon an individual tool call when a user cancels it without closing the connection or waiting for the configured request timeout.
Expected behavior
- Accept an optional cancellation token and per-call timeout.
- Check interruption before sending, after synchronous I/O returns, and after a suspended request resumes.
- Discard interrupted results, clear pending state, and keep the connection usable.
- Send
notifications/cancelledover STDIO and legacy HTTP. For HTTP protocol2026-07-28, use response-stream closure. - Log cancellation-notification failures without replacing the original interruption.
Async behavior and limitations
The client API remains synchronous. Cancellation is cooperative; this proposal does not add an async API, event loop, or framework-specific HTTP client.
- STDIO: cancellation and deadlines are checked while polling for responses. An interrupted request sends
notifications/cancelled. - HTTP: checks run when control returns from blocking PSR-18 requests or PSR-7 body reads. Cancellation cannot interrupt a wait for headers or the next body chunk.
- Legacy HTTP: a best-effort cancellation POST can itself block. Delivery failures are logged without replacing the original interruption.
- HTTP
2026-07-28: cancellation uses response-stream closure rather than a separate notification.
Per-call deadlines are not hard HTTP wall-clock limits. Applications still need network timeouts on their HTTP client. An async-capable underlying client does not change this when accessed through its synchronous PSR-18 interface.
Cancellation discards the result locally, but does not guarantee that server-side work stops or rolls back.
- 主要语言
- PHP
- 星标
- 1.6k
- 派生
- 173
- 平均合并
- 19 小时 19 分钟
- 30 天内合并 PR
- 8
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/php-sdk 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
modelcontextprotocol/php-sdk#516 ·
维护者通常 1 天内回复
-
[Server] Handler type uses bare Closure, hard to decorate RegistryInterface under strict PHPStan未关闭Server
难度 1/5 1 小时以内 新手友好度 78/100
modelcontextprotocol/php-sdk#468 · 2 条评论 ·
维护者通常 1 天内回复
-
needs confirmation needs maintainer action Server
难度 2/5 1-3 小时 新手友好度 68/100
modelcontextprotocol/php-sdk#398 · 1 个 reaction ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
modelcontextprotocol/php-sdk#370 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 65/100
modelcontextprotocol/php-sdk#513 ·
维护者通常 1 天内回复
查看 modelcontextprotocol/php-sdk 的全部 Issue
相似的 Issue
-
Infrastructure: actions Module: zmscitizenapi Module: zmsentities php Type: Bug unit tests
难度 2/5 1-3 小时 新手友好度 88/100
it-at-m/eappointment#3480 ·
维护者通常 1 天内回复
-
CI: composer install fails — league/flysystem 1.x blocked by security advisory GHSA-cxf4-7mrp-vvpr未关闭devops type: bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
needs approval
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 3 天内回复
-
product / avatars product / self-hosted product / storage
难度 2/5 1-3 小时 新手友好度 78/100
appwrite/appwrite#13985 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复