# Contexts

Contexts provide a way for nodes to implicitly pass values along an execution path, eliminating the need for explicit connections. For example, when an [`Http Endpoint`](/midio-docs/built-in-nodes/http.md#endpoint) node receives a request, it automatically makes an `EndpointContext` available to nodes it connects to. This allows an [`Http Response`](/midio-docs/built-in-nodes/http.md#response) node to access and respond to the request without requiring you to explicitly pass a *request object*.

<figure><img src="/files/NkZknMJjiZzBJPqUUx0A" alt="" width="563"><figcaption><p>You can check what contexts a trigger produces by hovering over its output.</p></figcaption></figure>

Some **input triggers** require specific contexts to function. These triggers either **consume** or **borrow** contexts:

* **Consuming a context** means it can only be used once. For example, `Http.Response.execute` **consumes** an `EndpointContext`, ensuring that a request can only be responded to once.
* **Borrowing a context** means it can be used multiple times without consuming it. For example, `Testing.AssertEqual.execute` **borrows** a `TestContext`, allowing multiple assertions within the same test.

**Some examples of functions in the standard library using contexts**

* [`Http Endpoint`](/midio-docs/built-in-nodes/http.md#endpoint) provides an `EndpointContext`, representing the incoming HTTP request, which is then consumed by the first call to [`Http Response`](/midio-docs/built-in-nodes/http.md#response).
* &#x20;[`Testing Test`](/midio-docs/built-in-nodes/core-std.md#test) provides a `TestContext`, representing a running test instance. This context is then borrowed by assertion functions like [`Std AssertEqual`](/midio-docs/built-in-nodes/core-std.md#assertequal).
* &#x20;[`Std For`](/midio-docs/built-in-nodes/core-std.md#for) provides a context which keeps track of the current loop index.

## Contexts in user defined functions

If your own functions use functions that require certain contexts, you need to explicitly add those contexts to your own functions triggers as well. If you for example want to perform an [`Http Response`](/midio-docs/built-in-nodes/http.md#response) call in your function, you need consume an `EndpointContext.`

<figure><img src="/files/ltZUUIOKikKknIqgjYBs" alt="" width="563"><figcaption><p>Click the + icon in the input trigger and search for <code>EndpointContext</code>.</p></figcaption></figure>


---

# 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://docs.midio.com/midio-docs/reference/the-midio-language/contexts.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.
