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

# Add To Context

![Add To Context Node configuration panel](https://mintcdn.com/cognigy-docs-legacy/sbu8K_1z3Hht9e7i/_assets/ai/develop/node-reference/logic/add-to-context.png?fit=max\&auto=format\&n=sbu8K_1z3Hht9e7i\&q=85\&s=e0d9240f5ef1101865ce35a81bb8ed49)

## Description

This Node stores information in the [Context](https://docs-classic.cognigy.com/ai/agents/develop/ai-agent-memory/context.md) object. With this approach, you can use the stored value throughout the session on subsequent user inputs.

## Parameters

| Parameter | Type | Description |
| - | - | - |
| Key | CognigyScript | The key where to store in the Context object. For example, if you enter `requestedProduct`, the value is assigned to the `context.requestedProduct` key. You can use nested keys, for example, entering `user.profile.name` assigns the value to the `context.user.profile.name` key. This parameter doesn't support dashes or hyphens. |
| Value | CognigyScript | The value to store in the Context object. |
| Mode | Select | <ul><li>**Simple** — assigns the value to the provided key.</li><li>**Array** — appends the value to an array stored under the key. If the key doesn't exist, a new array is created with the provided value as the first element. If the key contains a value that isn't an array, this value is replaced with an array including the value provided in this parameter.</li></ul> |

> [accordion] Storing an Object
>
> If you want to store an object in the Context object, use `.preserveType()` at the end of the CognigyScript expression to keep it as an object. For example, `input.slots.city[0].preserveType()` stores the Slot object for the first found city entity in the Context object.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.