---
id: "T:cAlgo.API.CommandArgs"
kind: "class"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Plugin/Commands/CommandArgs/"
---

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

# CommandArgs (class)

Represents a plugin command callback arguments.

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.

## Definition

```csharp
public class CommandArgs
```

## Examples

C#:

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

private void OnCommandExecuted(CommandArgs args)
{
    Print("Command {0} executed, context: {1}", args.Command.Id, args.Context);
}
```

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 {args.Command.Id} executed, context: {args.Context}")
```

## Properties

- `public Command Command {get;}` — Gets the command associated with these arguments. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Commands/CommandArgs/Command/index.md)
- `public object Context {get;}` — Gets the context in which the command is executed. [details](https://help.ctrader.com/ctrader-algo/references/Plugin/Commands/CommandArgs/Context/index.md)

