> For the complete documentation index, see [llms.txt](https://cyr1en.gitbook.io/commandprompter/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cyr1en.gitbook.io/commandprompter/features/console-delegate.md).

# Console Delegate

Console Delegate allows the console to initiate prompts for a target player and execute the final completed command **as the console**.

{% hint style="info" %}
This is the only secure way to prompt a player and execute the resulting command with console privileges.
{% endhint %}

### Why is this needed?

Executing commands as the console directly from a player-initiated prompt is a major security risk, as players could manipulate inputs to run unauthorized commands. Console Delegate solves this by delegating only the input gathering to the player, while the console retains control and executes the final command.

***

## Syntax & Usage

```
/consoledelegate <target> <command...>
```

* **`<target>`**: The player who will receive and answer the prompts.
* **`<command...>`**: The command (including prompts) to be executed by the console. Use `%target_player%` to reference the target player's name in the command.

{% hint style="info" %}

* This command must be executed by the console. If run by a player (even OP), it will not process.
* Tab-completion for `/consoledelegate` requires the `promptpaper.consoledelegate` permission.
  {% endhint %}

***

## Examples

### Basic Example

```
/consoledelegate CyR1en gamemode <what gamemode> %target_player%
```

1. **CyR1en** is prompted: *what gamemode*
2. CyR1en enters: `creative`
3. **Console** executes: `/gamemode creative CyR1en`

### With Post Command

```
/consoledelegate CyR1en gamemode <what gamemode> %target_player% <!broadcast Gamemode changed to {0} for %target_player%>
```

1. Console executes the main command as above.
2. Console then executes the post command: `/broadcast Gamemode changed to creative for CyR1en`

{% hint style="info" %}
Post commands attached to a console delegate session are executed by the player by default, unless explicitly marked with `@console`.
{% endhint %}


---

# 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 dynamically by asking a question.

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

```
GET https://cyr1en.gitbook.io/commandprompter/features/console-delegate.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
