Skip to main content

Class Definition

runId, activeStage, and logger are protected — accessible inside subclasses but not from outside. The provider registry is private; use get(token) / tryGet(token) to resolve dependencies.

Constructor

Properties (protected — visible to subclasses)

Methods

Dependency Injection

get<T>(token)

Get a required dependency from the provider registry.
Throws: DependencyNotFoundError if token is not registered.

tryGet<T>(token)

Try to get an optional dependency.

Context Access

get context()

Get the current request context.
Throws: RequestContextNotAvailableError if not in request scope.

tryGetContext()

Try to get request context without throwing.

Scope Access

get scope

Get the current scope with all registries.

Authentication

getAuthInfo()

Get authentication information for the current request.

Execution Tracking

mark(stage)

Mark the current execution stage for debugging and profiling.

Error Handling

fail(err)

Fail the execution with an error.

get error

Get the current error, if any.

HTTP Requests

fetch(input, init?)

Make HTTP requests with auto-injected headers.
Automatically injects:
  • Authorization headers
  • Trace context headers
  • Custom headers from context

Configuration

get config

Get typed configuration access (requires ConfigPlugin).

Protected Logger

get contextLogger

Get a child logger with request context.

Usage Example

ToolContext

Tool-specific context

ResourceContext

Resource-specific context

AgentContext

Agent-specific context

ProviderRegistry

Dependency injection