Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Client] Support cancellation and per-call deadlines in Client::callTool()

未关闭
#517 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
php
领域
api, backend

调研方向

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 内容生成。

描述

enhancement

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/cancelled over STDIO and legacy HTTP. For HTTP protocol 2026-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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

modelcontextprotocol/php-sdk 的其他 Issue

查看 modelcontextprotocol/php-sdk 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。