ITADN

Support request-level progressToken passthrough to tool handlers for long-running tool calls

#33Openchooron 创建于 2026-04-02
C
chooroncommented
## Problem Some tool calls take a relatively long time to complete. At the moment, `ModelContextProtocol.jl` does not pass the request-level `progressToken` through to the tool handler, which means the server cannot send `notifications/progress` while the tool is still running. As a result, the caller receives no intermediate status updates and can only wait for the final result. ## Expected behavior For long-running tool calls, the protocol layer should support passing the request's `progressToken` into the tool handler so that the handler can report progress asynchronously during execution. This would allow clients to show that the task has started, is still running, and has reached a certain stage before the final result is returned. ## Proposed change - Pass the request-level `progressToken` from the incoming MCP request down to the tool handler. - Allow long-running tool handlers to send `notifications/progress` during execution. - Support asynchronous progress reporting without changing the existing final result flow. - Keep backward compatibility for tool calls that do not use progress reporting. ## Use case We have tools whose execution may take several seconds or longer. In these cases, progress updates are needed so the client can provide feedback instead of appearing stuck until completion. ## Acceptance criteria - When a tool call includes a `progressToken`, the tool handler can access it during execution. - The server can emit one or more `notifications/progress` messages tied to that request. - The final tool result is still returned through the existing mechanism. - Requests without a `progressToken` continue to work as they do today.
0 条评论