FastestMCP.BackgroundTask (fastest_mcp v0.1.2)

Copy Markdown View Source

Handle returned for submitted background tasks.

A %FastestMCP.BackgroundTask{} is intentionally small. It is not the task state itself; it is the stable reference a caller can keep after an operation is offloaded.

Use it to:

  • fetch fresh task state
  • wait for completion
  • carry the access scope needed to reopen the task from application code

The full mutable state lives in the internal background-task store.

Summary

Functions

Waits for completion and refreshes the current task state.

Fetches the latest state managed by this module.

Types

t()

@type t() :: %FastestMCP.BackgroundTask{
  component_type: atom(),
  owner_fingerprint: String.t() | nil,
  poll_interval_ms: pos_integer(),
  server_name: String.t(),
  submitted_at: integer(),
  target: String.t() | nil,
  task_id: String.t(),
  ttl_ms: pos_integer() | nil
}

Functions

await(task, timeout \\ 5000)

Waits for completion and refreshes the current task state.

fetch(task)

Fetches the latest state managed by this module.