> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/relay/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/relay/_mcp/server.

# Struct Plugin Context

> Registration context passed to `WorkerPlugin::register`.

Generated from `cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker`.

```rust
pub struct PluginContext { /* private fields */ }
```

Registration context passed to [`WorkerPlugin::register`](/reference/api/rust-library-reference/nemo-relay-worker/trait-workerplugin).

## Implementations

### `impl PluginContext`

<pre />

#### `new`

<pre />

Creates an empty worker registration context.

#### `with_runtime`

<pre />

Creates an empty worker registration context with a host runtime handle.

#### `runtime`

<pre />

Returns the host runtime handle for event and scope operations.

#### `register_subscriber`

<pre />

Registers an event subscriber.

#### `register_tool_sanitize_request_guardrail`

<pre />

Registers a tool sanitize-request guardrail.

#### `register_tool_sanitize_response_guardrail`

<pre />

Registers a tool sanitize-response guardrail.

#### `register_tool_conditional_execution_guardrail`

<pre />

Registers a tool conditional-execution guardrail.

#### `register_tool_request_intercept`

<pre />

Registers a tool request intercept.

#### `register_tool_execution_intercept`

<pre />

Registers a tool execution intercept.

The callback returns a [`ToolExecutionInterceptOutcome`](/reference/api/rust-library-reference/nemo-relay-worker/struct-toolexecutioninterceptoutcome). Calling [`ToolNext::call`](/reference/api/rust-library-reference/nemo-relay-worker/struct-toolnext) continues the chain and returns only the raw downstream result JSON; Relay retains downstream pending marks.

#### `register_llm_sanitize_request_guardrail`

<pre />

Registers an LLM sanitize-request guardrail.

#### `register_llm_sanitize_response_guardrail`

<pre />

Registers an LLM sanitize-response guardrail.

#### `register_llm_conditional_execution_guardrail`

<pre />

Registers an LLM conditional-execution guardrail.

#### `register_llm_request_intercept`

<pre />

Registers an LLM request intercept.

#### `register_llm_execution_intercept`

<pre />

Registers an LLM execution intercept.

#### `register_llm_stream_execution_intercept`

<pre />

Registers an LLM stream execution intercept.

## Trait Implementations

### `impl Default for PluginContext`

<pre />

#### `default`

<pre />