ResponseContext Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides the handler with the response identifier, raw body, input items,
conversation history, and forwarded client metadata.
The handler communicates state exclusively through events yielded from
ResponseEventStream; the mutable Response object is
not exposed.
public class ResponseContext
type ResponseContext = class
Public Class ResponseContext
- Inheritance
-
ResponseContext
Constructors
| Name | Description |
|---|---|
| ResponseContext(String) |
Initializes a new instance of ResponseContext with the given response ID. All other properties use safe defaults (empty body, empty collections). |
Properties
| Name | Description |
|---|---|
| ClientHeaders |
Gets the forwarded client headers (those prefixed with |
| Isolation |
Gets the platform-injected isolation keys for this request. Handlers use these opaque partition keys to scope user-private and conversation-shared state. Returns Empty when the platform headers are absent (e.g., local development). |
| IsShutdownRequested |
Gets or sets whether the server is shutting down. Handlers can use this to distinguish shutdown from explicit cancel or client disconnect. |
| QueryParameters |
Gets the query parameters from the original HTTP request. |
| RawBody |
Gets the full raw JSON request body as a BinaryData.
Allows handlers to access custom or extension fields that are not part of the typed model.
Returns |
| ResponseId |
Gets the unique response identifier. |
Methods
| Name | Description |
|---|---|
| GetHistoryAsync(CancellationToken) |
Resolves and returns the conversation history items for the current request.
History is fetched from the provider using |
| GetInputItemsAsync(Boolean, CancellationToken) |
Resolves and returns the input items for the current request.
Inline items are returned as their Item subtypes;
item references are optionally resolved via the provider and converted
to Item subtypes. Results are cached after the first call
for each |
| GetInputTextAsync(Boolean, CancellationToken) |
Resolves input items and extracts all text content as a single string. Filters for ItemMessage items, expands their content, and joins all text values with newline separators. |
Extension Methods
| Name | Description |
|---|---|
| NewApplyPatchCallItemId(ResponseContext) |
Generates a new apply-patch call item ID sharing the response's partition key. |
| NewApplyPatchCallOutputItemId(ResponseContext) |
Generates a new apply-patch call output item ID sharing the response's partition key. |
| NewCodeInterpreterCallItemId(ResponseContext) |
Generates a new code interpreter call item ID sharing the response's partition key. |
| NewCompactionItemId(ResponseContext) |
Generates a new compaction item ID sharing the response's partition key. |
| NewComputerCallItemId(ResponseContext) |
Generates a new computer call item ID sharing the response's partition key. |
| NewComputerCallOutputItemId(ResponseContext) |
Generates a new computer call output item ID sharing the response's partition key. |
| NewCustomToolCallItemId(ResponseContext) |
Generates a new custom tool call item ID sharing the response's partition key. |
| NewCustomToolCallOutputItemId(ResponseContext) |
Generates a new custom tool call output item ID sharing the response's partition key. |
| NewFileSearchCallItemId(ResponseContext) |
Generates a new file search call item ID sharing the response's partition key. |
| NewFunctionCallItemId(ResponseContext) |
Generates a new function tool call item ID sharing the response's partition key. |
| NewFunctionCallOutputItemId(ResponseContext) |
Generates a new function call output item ID sharing the response's partition key. |
| NewFunctionShellCallItemId(ResponseContext) |
Generates a new function shell call item ID sharing the response's partition key. |
| NewFunctionShellCallOutputItemId(ResponseContext) |
Generates a new function shell call output item ID sharing the response's partition key. |
| NewImageGenCallItemId(ResponseContext) |
Generates a new image generation call item ID sharing the response's partition key. |
| NewItemId(ResponseContext) |
Generates a new generic item ID sharing the response's partition key. |
| NewLocalShellCallItemId(ResponseContext) |
Generates a new local shell call item ID sharing the response's partition key. |
| NewLocalShellCallOutputItemId(ResponseContext) |
Generates a new local shell call output item ID sharing the response's partition key. |
| NewMcpApprovalRequestItemId(ResponseContext) |
Generates a new MCP approval request item ID sharing the response's partition key. |
| NewMcpApprovalResponseItemId(ResponseContext) |
Generates a new MCP approval response item ID sharing the response's partition key. |
| NewMcpCallItemId(ResponseContext) |
Generates a new MCP tool call item ID sharing the response's partition key. |
| NewMcpListToolsItemId(ResponseContext) |
Generates a new MCP list tools item ID sharing the response's partition key. |
| NewMessageItemId(ResponseContext) |
Generates a new output message item ID sharing the response's partition key. |
| NewOutputMessageItemId(ResponseContext) |
Generates a new output message item ID sharing the response's partition key. |
| NewReasoningItemId(ResponseContext) |
Generates a new reasoning item ID sharing the response's partition key. |
| NewStructuredOutputItemId(ResponseContext) |
Generates a new structured output item ID sharing the response's partition key. |
| NewWebSearchCallItemId(ResponseContext) |
Generates a new web search call item ID sharing the response's partition key. |
| NewWorkflowActionItemId(ResponseContext) |
Generates a new workflow action item ID sharing the response's partition key. |