> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloud.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Context Overview

> Context gives AI models the business knowledge for turning a question into an accurate query.

> [!NOTE]
>
> Context is in early access. Early access features are pre-production software under section 1.4 of
> the [Cloud Services Agreement](https://docs.cloud.cdata.com/en/terms-of-service.md) and are not for production use. To join the
> program, [request early access](https://www.cdata.com/ai/gateway-early-access/).

An AI model knows your data sources by their table and column names. It does not know that your team calls the `total_sales` column "revenue," or which of three customer tables is the one that finance trusts. Context fills that gap. It gives AI models business terms, dataset definitions, and column mappings, so that they can translate a question into an accurate query.

## Why Context Matters

Context improves three things:

* **Accuracy:** the model maps your business language to the right columns and datasets.
* **Speed:** replies come back faster.
* **Cost:** the model uses fewer tokens to find the data that it needs.

## Kinds of Context

Connect AI has two kinds of context: global context, which describes your data, and user context, which describes you. The following table compares them.

| Question | Global context | User context |
| - | - | - |
| What it describes | Your data: what each connection, dataset, metric, and business term means | You: your role, the kind of answers that you prefer, and your time zone |
| Where it applies | The whole account, a connection, or a dataset. If your account uses workspaces, each workspace has its own, called Workspace Context. | Your own conversations |
| Where you manage it | **Global Context** in the [Context Editor](https://docs.cloud.cdata.com/en/Context-Editor.md) | [User Context](https://docs.cloud.cdata.com/en/Settings/User-Context.md) in **Settings**, or the Context Editor |
| Who can change it | Administrators, Workspace Administrators, and Connection Administrators (see [Roles](https://docs.cloud.cdata.com/en/Roles-Policies/Roles.md)). Query users don't see it; they get it only through the AI. | You |

Connect AI doesn't rank one kind of context above the other. Both go to the model together, and the model decides how to use them. Put shared definitions and business rules in global context, and personal details, such as your role, the filters you usually apply, and how you want answers, in user context.

## What Global Context Contains

Global context forms a graph of the following entity types:

* **Global Context:** terms and rules that apply to every connection and dataset.
* **Connection:** context for one data source, which applies to all of its datasets.
* **Dataset:** field-level details for one table or query.
* **Metric:** a reusable measure on one or more fields.
* **Glossary:** business terms and rules, optionally linked to columns. For example, a glossary entry can map *Revenue* to the `total_sales` column.

## How Models Get Context

How context reaches the model depends on how the model connects to Connect AI.

| Connection | How context reaches the model |
| - | - |
| MCP server or a tool server | The agent calls the `search_context` tool. The tool returns the relevant datasets with their fully qualified names, field descriptions, and join hints. On its first call, the agent also requests your user context. |
| LLM Gateway | Only if the project's [routing rule](https://docs.cloud.cdata.com/en/LLM-Gateway/Routing-Rules.md) turns them on under **Prompt Enrichment**. Global context is searched on every message. User context is sent once, at the beginning of each conversation. If they're off, Connect AI doesn't add context, and the model gets at most a hint to call `search_context`. |

## Where Context Comes From

You can add global context in the following ways:

* **Import** an existing semantic model: a dbt semantic layer, a Snowflake semantic view, or a Power BI file.
* **Generate** context with AI.
* **Write** context in the built-in editor, starting from a template.

Context is built from metadata, such as dbt manifests, Power BI definitions, and joins. When you generate context with AI, you can also include sample values from your tables to improve accuracy. Sample values are sent to the LLM. You can turn them off for the whole account by turning off **Include Sample Values** in **Settings > Security**. Sample values are not available on accounts with a HIPAA Business Associate Agreement.

Changes to global context take effect as soon as you save them. There is no approval step. Approving generated context keeps it from being overwritten when someone generates or imports context again.

## Performance

A `search_context` call typically takes 1.5 to 2 seconds.

## Early Access

Context is available through the early access program, which accepts a limited number of participants. To apply, [request early access](https://www.cdata.com/ai/gateway-early-access/). CData replies within two business days, reviews each request, and then turns on Context for your account.

## Next Steps

> [card] [Context Editor](https://docs.cloud.cdata.com/en/Context-Editor.md)
>
> Add, import, and review global context.

> [card] [User Context](https://docs.cloud.cdata.com/en/Settings/User-Context.md)
>
> Tell the model about yourself.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.