class RubyLLM::MCP::Task

A tool call that an MCP server runs in the background, as the Tasks extension describes. Declare MCP.extension :tasks, and a server may answer a long call with a task instead of a result.

A chat never waits for a task. It pauses the tool call, and Chat#pending_tasks returns the tasks it waits on. refresh checks on a task once; Chat#complete checks on every one again and resumes the chat once they are done:

task = chat.pending_tasks.first
task.refresh
task.status         # => :working
task.status_message # => "Rendering page 3 of 12"
task.poll_interval  # => 5.0

MCP#call waits for the task of a tool you call directly.