T3.HTTP (T3 v0.3.0)

Copy Markdown View Source

Explicit HTTP access to T3's environment API, independent of the MCP session.

http = T3.HTTP.new(base_url: "http://127.0.0.1:3773", token: access_token)
T3.HTTP.Orchestration.thread_transcript(http, thread_id)
T3.HTTP.call(http, :orchestration_thread_history_page,
  params: %{"threadId" => thread_id}, query: %{"cursor" => cursor})

Successes return {:ok, %T3.HTTP.Response{}}; failures return {:error, %T3.Error{}}. Configure :finch for a custom supervised Finch pool; the SDK application starts T3.HTTP.Finch by default. Credentials need the endpoint's own scopes: the presence of an MCP token does not imply HTTP authorization.

JSON routes accept json: wire_map, token exchanges accept form: wire_map, and uploads/webhooks accept body: exact_bytes. Payload schemas remain T3's responsibility. There are no automatic retries, redirects or cookie storage.

Summary

Functions

Call a declared endpoint using :params, :query, :json, :form, :body and :headers options.

Cancel a streaming Task owned by this process and close its network worker.

Return every declared HTTP endpoint.

Build a multipart body from string fields and local-file or in-memory file tuples.

Create an HTTP configuration. Requires an origin URL, HTTPS or loopback HTTP.

Routes implemented outside EnvironmentHttpApi, including guest/device/media APIs.

Send one same-origin HTTP request. Relative root paths only; absolute URLs and network-path references are rejected so bearer credentials cannot cross origins. :decode may be :auto (default), :json, or :binary. Response bodies are bounded by max_body_bytes; receive and pool timeouts are bounded too.

Start a cancellable streaming Task owned by the calling process.

Stream a response with synchronous callback backpressure; see T3.HTTP.Stream.

POST exact attachment bytes to the relative URL returned by t3_attachment_prepare_upload.

Types

t()

@type t() :: %T3.HTTP{
  auth_scheme: term(),
  base_url: term(),
  finch: term(),
  headers: term(),
  max_body_bytes: term(),
  pool_timeout: term(),
  timeout: term(),
  token: term()
}

Functions

call(client, endpoint, opts \\ [])

Call a declared endpoint using :params, :query, :json, :form, :body and :headers options.

cancel_stream(task)

Cancel a streaming Task owned by this process and close its network worker.

endpoints()

Return every declared HTTP endpoint.

multipart(fields, files \\ [])

Build a multipart body from string fields and local-file or in-memory file tuples.

new(opts)

Create an HTTP configuration. Requires an origin URL, HTTPS or loopback HTTP.

raw_endpoints()

Routes implemented outside EnvironmentHttpApi, including guest/device/media APIs.

request(client, method, path, opts \\ [])

Send one same-origin HTTP request. Relative root paths only; absolute URLs and network-path references are rejected so bearer credentials cannot cross origins. :decode may be :auto (default), :json, or :binary. Response bodies are bounded by max_body_bytes; receive and pool timeouts are bounded too.

start_stream(client, method, path, callback, opts \\ [])

Start a cancellable streaming Task owned by the calling process.

stream(client, method, path, callback, opts \\ [])

Stream a response with synchronous callback backpressure; see T3.HTTP.Stream.

upload(client, relative_url, bytes, opts \\ [])

POST exact attachment bytes to the relative URL returned by t3_attachment_prepare_upload.