---
id: "P:cAlgo.API.CommandArgs.Context"
kind: "property"
type: "T:cAlgo.API.CommandArgs"
url: "https://help.ctrader.com/ctrader-algo/references/Plugin/Commands/CommandArgs/Context/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# CommandArgs.Context

Member of [CommandArgs](https://help.ctrader.com/ctrader-algo/references/Plugin/Commands/CommandArgs/index.md).

## Context

Gets the context in which the command is executed.

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: Available to plugins only, and plugins cannot run in the CLI.
- Cloud: Available to plugins only, and plugins cannot run in the cloud.

C#:

```csharp
public object Context {get;}
```

Python:

```python
commandArgs.Context: object
```

### Returns

`object` — 

### Examples

C#:

```csharp
protected override void OnStart()
{
    Commands.Add(CommandType.ChartContainerToolbar, OnCommandExecuted);
}

private void OnCommandExecuted(CommandArgs args)
{
    if (args.Context is ChartContainer chartContainer)
        Print("Executed from chart container {0}", chartContainer.Id);
}
```

Python:

```python
from System import Action

def on_start(self):
    api.Commands.Add(CommandType.ChartContainerToolbar, Action[CommandArgs](self.on_command_executed))

def on_command_executed(self, args):
    api.Print(f"Command context: {args.Context}")
```

