# mentalCommandActiveAction

This method is to get or set the active actions for the mental command detection.

If an action is inactive, then the mental command detection won't detect it anymore. Deactivate an action do not erase its trainings from the profile.

Check out [adding new commands](https://emotiv.gitbook.io/emotivbci/mental-commands/adding-new-commands) and [deactivating commands](https://emotiv.gitbook.io/emotivbci/mental-commands/deactivating-commands) in our BCI app.

## Parameters

| Name        | Type              | Required | Description                                                                                                                                                                   |
| ----------- | ----------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| cortexToken | `string`          | yes      | A token returned by [authorize](https://emotiv.gitbook.io/cortex-api/authentication/authorize).                                                                               |
| status      | `string`          | yes      | Must be "set" or "get".                                                                                                                                                       |
| profile     | `string`          | no       | A profile name.                                                                                                                                                               |
| session     | `string`          | no       | A session id returned by [createSession](https://emotiv.gitbook.io/cortex-api/session/createsession).                                                                         |
| actions     | `array of string` | no       | <p>If the <strong>status</strong> is "set", this parameter is the list of actions to activate.<br>You can't activate more than 4 actions. This doesn't include "neutral".</p> |

You must set one of these 2 parameters: **profile** or **session**. [Read this](https://emotiv.gitbook.io/cortex-api/advanced-bci/..#profile-name-or-session-id) for details.

## Result

If the **status** is "get", then the result is an `array of strings` that is the list of active actions.&#x20;

If the **status** is "set", then the result is an object with these fields:

| Name    | Type               | Description         |
| ------- | ------------------ | ------------------- |
| actions | `array of strings` | The active actions. |
| message | `string`           | A success message.  |

## Examples

### Get

{% tabs %}
{% tab title="Request" %}

```javascript
{
    "id": 544314,
    "jsonrpc": "2.0",
    "method": "mentalCommandActiveAction",
    "params": {
        "cortexToken": "xxx",
        "profile": "cortex-v2-example",
        "status": "get"
    }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
    "id": 544314,
    "jsonrpc": "2.0",
    "result": [
        "neutral",
        "push",
        "pull"
    ]
}
```

{% endtab %}
{% endtabs %}

### Set

{% tabs %}
{% tab title="Request" %}

```javascript
{
    "id": 411114,
    "jsonrpc": "2.0",
    "method": "mentalCommandActiveAction",
    "params": {
        "actions": [
            "push"
        ],
        "cortexToken": "xxx",
        "session": "1d5d3655-d570-4731-9faf-967bc5440dc5",
        "status": "set"
    }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
    "id": 411114,
    "jsonrpc": "2.0",
    "result": {
        "actions": [
            "push"
        ],
        "message": "Set MentalCommand active actions successfully"
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://emotiv.gitbook.io/cortex-api/advanced-bci/mentalcommandactiveaction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
