> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/xsoar-6-administrator-guide/6.14/customize-cortex-xsoar/customize-and-configure-cortex-xsoar/playbooks/extend-context/extend-context-using-the-command-line.md).

# Extend Context using the Command Line

Extend Cortex XSOAR 6.14 context using command-line commands.

You can extend context either in a playbook task, or directly from the command line. Whichever method you use, Cortex XSOAR recommends that you first run your command with the **`raw-response=true`** flag. This will help you identify the information that you want to add to your extended data.

1. Run your command with the extend-context flag **`!`*****`<commandName>`*** ***`<argumentName> <value>`*****`extend-context=contextKey=JsonOutputPath`**.

   For example, to add the user and manager fields to context use the ad-get-user command, as follows:

   **`!ad-get-user username=${user.manager.username} extend-context=manager=attributes.manager::attributes=displayName`**
2. To output only the values that you set as Extend context, run the command with the ignore-output flag=true. **`!ad-get-user username=${user.manager.username} extend-context=manager=attributes.manager::attributes=displayName ignore-output=true`**

**Example**

By default, after adding the IBM Qradar v3 integration instance, offenses pulled from QRadar to Cortex XSOAR return a number of fields, including event count, offense type, description, etc. You can use extended context to show which additional information is available and also use that information to map it to a field.

* Run the command **`!qradar-offenses raw-response="true"`**. From the context data, you see that there are a number of additional fields that are retrieved.
* Identify the fields that you want to add and run your command. For example, to retrieve the number of devices affected by a given offense, as well as the domain in which those devices reside, run the following command: **`!qradar-offenses extend-context=device-count=device_count::domain-id=domain_id`**

The following image shows how to create an extended context key from the CLI in the playground.

![playbook-extend-context-cli.png](https://3548014557-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHlpKeFtqCLUYKuYyccd%2Fuploads%2Fgit-blob-0a5e64ea1b63189d1c6195ee89d9ff0103144b65%2F1c79f59d5210f7921200c799b8029abdae56dabe9a162d19eb2a0ade49b25daa.png?alt=media)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/xsoar-6-administrator-guide/6.14/customize-cortex-xsoar/customize-and-configure-cortex-xsoar/playbooks/extend-context/extend-context-using-the-command-line.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
