McpHouse.Client.Operation (mcp_house v0.1.0)

Copy Markdown View Source

A handle for an asynchronous tool call or subscription.

McpHouse.Client.start_tool_call/4 returns this handle directly. McpHouse.Client.subscribe/4 returns it in an {:ok, operation} tuple. The process that starts the operation owns its lifetime. Use await/2 to collect its result and cancel/1 to request cancellation. These functions are also available through McpHouse.Client.

Summary

Types

t()

A handle returned when a client operation starts.

Functions

Collects the operation's terminal result.

Requests cancellation and sends a protocol cancellation signal when applicable.

Returns a specification to start this module under a supervisor.

Types

t()

@opaque t()

A handle returned when a client operation starts.

Functions

await(operation, timeout \\ 5000)

Collects the operation's terminal result.

The timeout is in milliseconds and defaults to 5,000. Pass :infinity to wait without a limit. A wait timeout returns {:error, :await_timeout} and leaves the operation running. Collect a terminal result once.

cancel(operation)

Requests cancellation and sends a protocol cancellation signal when applicable.

Returns :ok for a successful cancellation or an already closed operation. Cancellation can return an error if sending the notification or cleaning up the stream fails. Use await/2 to collect the terminal result.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.