[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 天內回覆
-
bug
難度 4/5 3-5 天 新手友好度 48/100
modelcontextprotocol/php-sdk#522 · 1 個 reaction ·
維護者通常 1 天內回覆
查看 modelcontextprotocol/php-sdk 的全部 Issue
相似的 Issue
-
sync-en
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 2 天內回覆
-
UX
難度 2/5 1-3 小時 新手友好度 72/100
ProfessionalWiki/NeoWiki#1573 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
-
難度 2/5 1-3 小時 新手友好度 68/100