Skip to main content

Class Hierarchy

Common Features

All context classes provide:

Dependency Injection

Scope Access

Logging

Authentication

For ExecutionContextBase-derived contexts (Tool, Resource, Agent, Skill, Job, Channel) read auth from the request context:
PromptContext does not extend ExecutionContextBase and exposes authInfo directly:

Execution Tracking

Error Handling

Context-Specific Features

ToolContext

Notifications, progress, elicitation, platform detection

ResourceContext

URI handling, parameter extraction

PromptContext

Argument handling, prompt building

AgentContext

LLM completion, tool execution, agent loop

SkillContext

Instruction loading, skill building

JobContext

Logging, progress, retry tracking

ChannelContext

Server→client notifications, broadcasts

ExecutionContextBase

Base class with shared functionality

Context Extensions

Plugins can extend all context classes with custom properties:

Request Context

Contexts that extend ExecutionContextBase (Tool, Resource, Agent, Skill, Job, Channel) can access the unified request context. PromptContext does NOT extend ExecutionContextBase and does not expose this.context or this.fetch() — it only carries args, metadata, runId, authInfo, scope, plus get/tryGet for DI.

HTTP Fetch

Contexts that extend ExecutionContextBase provide a context-aware fetch() (not available on PromptContext):

Configuration Access

When ConfigPlugin is installed:

Best Practices

Let the Decorator Infer Types

The @Tool decorator infers input/output types from the schema — extend ToolContext without generics and let TypeScript do the rest.

Handle Errors Gracefully

Use Stage Markers

Leverage Platform Detection