Skip to content

pendingOf — read a suspension off a result

Elixir · package toolnexus · SPEC §10

Detect that a RunResult is parked rather than finished, and get the Request that parked it.

Two calls cover it. Toolnexus.ToolResult.pending?/1 tells you a result is a suspension; matching metadata.pending directly gets you the Request:

alias Toolnexus.{ToolResult, Request}
case result do
%ToolResult{metadata: %{pending: %Request{} = req}} -> req
_ -> nil
end

At the RunResult level, Toolnexus.Client.run/4 already surfaces this without a helper: result.status == "pending" and result.pending is the Request directly (no reader call needed — see Client.run).