> ## Documentation Index
> Fetch the complete documentation index at: https://redop.useagents.site/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Request, Context, and Handler Events

> Reference for ToolRequest, Context, and the event objects Redop passes to handlers, middleware, and hooks.

## `request`

`request` is transport metadata for the current invocation.

Common fields:

* `headers`
* `transport`
* `sessionId?`
* `ip?`
* `method?`
* `url?`
* `raw?`
* `abortSignal?`
* `progressCallback?`

These fields are optional when the active transport cannot provide them.

## Base request context

All context variants share these built-in fields:

* `headers`
* `rawParams`
* `requestId`
* `sessionId?`
* `transport`

`ctx` is mutable per-request state shared across derive functions, hooks, middleware, and the active handler.

## Tool context

Tool handlers, tool middleware, and tool hooks receive a context with:

* the shared base request fields
* `tool`

## Resource context

Resource handlers, resource middleware, and resource hooks receive a context with:

* the shared base request fields
* `resource`

## Prompt context

Prompt handlers, prompt middleware, and prompt hooks receive a context with:

* the shared base request fields
* `prompt`

## Tool handler event

Tool handlers receive:

* `input`
* `ctx`
* `request`
* `tool`
* `emit.progress(...)`
* `signal`

## Tool middleware event

Tool middleware receives the same event plus:

* `next()`

## Tool hook events

* before hooks receive `ctx`, `input`, `request`, `tool`
* after hooks also receive `result`
* after-response hooks receive `kind`, `name`, and optional `result` or `error`
* error hooks receive `error`
* transform hooks receive `params`
* parse hooks receive parsed `input`

## Resource and prompt events

Resource events use the resource context plus resource-specific fields:

* resources receive `uri`
* template resources can also receive `params`
* resource middleware also receives `next()`

Prompt events use the prompt context plus prompt-specific fields:

* prompts receive `name`
* prompt handlers can receive `arguments`
* prompt middleware also receives `next()`
