# Context

Okay. You know what a format is, but you want to know how to *actually* do stuff when your command is executed. That's where the Context comes in. It has only one purpose: to facilitate your logic. It allows you to get the **sender** of a command, along with the **executor**, and all **arguments**.

```java
addFormat("int:foo", context -> {
            if (!(context.getSender() instanceof final Player player)) {
                return;
            }
            final int foo = context.get("foo");
            final CommandSender sender = context.getSender();
            sender.sendMessage(player.getName());
            sender.sendMessage(Component.text(foo));
        });
```

In the above code, you can see why you *need* a context. Without it, your command wouldn't do anything! However, you may be wondering what the difference between a **sender** and an **executor** is. To find out, visit the [Senders And Executors](/slimecraft-docs/deep-dive/context/senders-and-executors.md) page.

> A context allows you to execute logic **after** your command is executed.


---

# 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://slimecraft.gitbook.io/slimecraft-docs/deep-dive/context.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.
