# Type Safety

Arguments also support type safety. This is done through the use of the `ArgumentKey<T>` record. When in a `Context` and doing `.get("foo")` , you can instead do `.get(key)`.

```java
final ArgumentKey<Integer> fooKey = new ArgumentKey<>("foo", Integer.class);
addFormat("brigader example foo:int bar:float baz:person", ctx -> {
final int foo = ctx.get(fooKey);
});
```

This mitigates the type-safety issues with retrieving and using arguments.

> Anywhere that an argument name can be used, a key can also be used. This includes getting arguments and suggestions.


---

# 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/arguments/type-safety.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.
