A server-side task a tool call was turned into.
ConduitMcp.Client.call_tool/4 with task: :return returns one when the
server ran the call as a task:
- modern (
2026-07-28, theio.modelcontextprotocol/tasksextension): the server answeredresultType: "task"; - legacy (
2025-11-25): the client task-augmented the call (the tool'sexecution.taskSupportallowed it and the server declaredtasks.requests.tools.call) and the server answeredCreateTaskResult.
Poll it with ConduitMcp.Client.get_task/3, wait for its result with
ConduitMcp.Client.await_task/3, or cancel it with
ConduitMcp.Client.cancel_task/3.
Fields
id- the server's task id. Task ids are bound to the credential that created them and may act as bearer tokens: never log them.status-:working,:input_required,:completed,:failed,:cancelled, or:unknownfor a value this client does not know.status_message,created_at,last_updated_at(ISO 8601 strings).ttl_ms- how long the server keeps it (nilfor unlimited).poll_interval_ms- the server's suggested polling interval, ornil.input_requests- moderninput_requiredonly: the outstanding requests, keyed as the server keyed them.result- moderncompletedonly: the final result map.error- modernfailedonly: the JSON-RPC error object.era,server_id- where it lives; the poll functions use them.raw- the server's string-keyed task map.
Summary
Types
@type status() ::
:working | :input_required | :completed | :failed | :cancelled | :unknown
@type t() :: %ConduitMcp.Client.Task{ created_at: String.t() | nil, era: :modern | :legacy, error: map() | nil, id: String.t(), input_requests: map() | nil, last_updated_at: String.t() | nil, poll_interval_ms: non_neg_integer() | nil, raw: map(), result: map() | nil, server_id: String.t(), status: status(), status_message: String.t() | nil, ttl_ms: non_neg_integer() | nil }
Functions
@spec from_wire(String.t(), :modern | :legacy, term()) :: {:ok, t()} | {:error, ConduitMcp.Client.Error.t()}
Builds a task from a wire Task map: the modern CreateTaskResult /
tasks/get result, or a legacy Task (legacy keys ttl and
pollInterval are read as well). A map without a string taskId is a
:protocol error with reason :invalid_task.
iex> {:ok, task} =
...> ConduitMcp.Client.Task.from_wire("files", :modern, %{
...> "taskId" => "t1",
...> "status" => "working",
...> "pollIntervalMs" => 500
...> })
iex> {task.status, task.poll_interval_ms}
{:working, 500}
Whether task reached a terminal status.