> ## 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 Editor

> Improve query accuracy and reply times, and save tokens by providing business terms, dataset definitions, and column mappings that the MCP server uses to interpret your prompts.

<Note>The Context Editor is currently in beta as part of an early access program. More information about joining the program is available on the [CData AI page](https://www.cdata.com/ai).</Note>

The Context Editor gives AI models the business knowledge they need to translate natural language prompts into accurate data queries. You can import context from an existing resource (add external context), or create context manually using the built-in editor (add new context).

The left pane of the **Context Editor** page (in list view) contains **User Context** and **Global Context**.

## User Context

User context is the information about yourself that Connect AI sends to the AI automatically: once at the beginning of each conversation when you use the LLM Gateway, and together with the results of the `search_context` tool when you use the MCP server. You can add information such as your role, what kind of answers you prefer, and your time zone. The editor supports Markdown. You can add or edit information on this page or in the **User Context** tab of **Settings**.

## Global Context

Global context manages what AI agents know about your data.

### List View

Click **Global Context** and the list view icon to view a list of all the entities in your account and the number of named contexts assigned to them. The named contexts directly under **Global Context** apply to all connections and datasets, and you can have many of them. Use the search bar to find an entity. Expand an entity in the left pane to view the named contexts assigned to it. Click **+ Add Context** to add a new context or a new external context.

### Graph View

Click **Global Context** and the graph view icon to view a context graph of all the context entities and how they relate to each other across the semantic layer. Use the search bar to find an entity in the graph.

<Frame>
  <img src="https://mintcdn.com/cdata/DZFTvJCMSaIDt4Ld/en/images/context_editor_graph.png?fit=max&auto=format&n=DZFTvJCMSaIDt4Ld&q=85&s=51a6544f64cebb5a07a7eea67c7de963" alt="Context graph showing context editor entities and their relationships across the semantic layer" width="1412" height="736" data-path="en/images/context_editor_graph.png" />
</Frame>

The context graph contains the following entity types:

* **Global Context**: The account-level context that applies to all connections and datasets. Use Global Context to define terms and rules that span your entire data environment.
* **Connection**: A named data source (for example, *MailChimp* or *PostgreSQL*). Context defined at the connection level applies to all datasets within that connection.
* **Dataset**: A table or query within a connection. Dataset-level context provides field-specific details to help the MCP server interpret queries against that dataset.
* **Metric**: A reusable measure defined on one or more fields. Metrics are created by importing a dbt semantic layer or a Snowflake semantic view.
* **Glossary**: Business terms, rules, and other business knowledge, optionally linked to columns. Glossary entries let the MCP server recognize business language. For example, map *Revenue* to the `total_sales` column so that prompts return accurate results.

### View Context Details

In list view or graph view, click an entity to view details about the entity.

<Frame>
  <img src="https://mintcdn.com/cdata/DZFTvJCMSaIDt4Ld/en/images/context_editor_detail.png?fit=max&auto=format&n=DZFTvJCMSaIDt4Ld&q=85&s=2cb17f3e0edb1bcd1f3240dea5bdc69d" alt="Context details panel for a selected entity" width="1409" height="740" data-path="en/images/context_editor_detail.png" />
</Frame>

## Add Context

There are two ways to add context:

* **Options menu**: Click the options menu (⋮) to the right of an entity to add context directly to that entity.
* **Add Context button**: Click **Add Context** to add context. You must select the entity type to apply it to: a specific connection or global context that applies to all connections and datasets.

You can import context from a dbt or Power BI file, or generate context using AI. You can also add new context manually by editing a context template.

### Add External Context

Use Add External Context to add semantic context globally or to a connection. The connection appears as the parent, with an expandable list of its datasets below it.

<Steps>
  <Step>
    Click **+ Add Context > Add External Context**. A dialog appears.
  </Step>

  <Step>
    In **Step 1** of the dialog, select a resource from the list of connections, or select **Global Context** to apply the context to all connections and datasets. Use the search bar to narrow down your search.
  </Step>

  <Step>
    Click **Next**.
  </Step>

  <Step>
    In **Step 2** of the dialog, select the **Source** of the semantic context: **dbt** or **Power BI**. Alternatively, you can have Connect AI generate context using AI.

    * For **dbt**, paste the contents of `manifest.json` in the space below.
    * For **Power BI**, select the Power BI (.pbix) file containing the semantic context.
      <Note>Snowflake connection context has an additional option: a **Snowflake Semantic View** YAML file.</Note>
    * For **Generate Context**, under **Tables** select **Generate context from all tables** or **Generate context from selected tables**. With selected tables, pick the tables in the list that appears. Toggle **Include Sample Values** on to improve accuracy, then click **Generate**. Sample values are available only when they are allowed in **Settings > Security** and the account has no HIPAA BAA; when the toggle is on, sample rows from the selected tables are sent to the LLM.

      **Generate Context** requires an authenticated connection, because it reads the tables through that connection. For a connection where each user signs in with their own credentials, the user generating context must have authenticated it themselves.

      You can close this dialog and Connect AI continues to generate context in the background.

      <Note>Generated context cannot be used on global context, only connection context.</Note>
  </Step>

  <Step>
    Click **Add** to add the context, or click **Generate** to generate context. The new context appears in the list under the resource you selected in Step 1: under Global Context, or under the connection with its datasets listed below it.
  </Step>
</Steps>

### Add New Context

To add a new context document manually to Global Context or to a connection, do the following:

<Steps>
  <Step>
    Click **+ Add Context > Add New Context**. A dialog appears.
  </Step>

  <Step>
    In **Step 1** of the dialog, select a resource from the list of connections, or select **Global Context** to apply the context to all connections and datasets. Use the search bar to narrow down your search.
  </Step>

  <Step>
    Click **Next**.
  </Step>

  <Step>
    In **Step 2** of the dialog, enter a name for the new context.
  </Step>

  <Step>
    Click **Add**.
  </Step>

  <Step>
    Edit the context template to define terms, relationships, or business rules that help the MCP server interpret your prompts accurately. See [Example: Jira Issues Dataset](#example-jira-issues-dataset) for a completed template.
  </Step>

  <Step>
    Click **Save**.
  </Step>
</Steps>

### Example: Jira Issues Dataset

The context template uses the following fields:

* **type**–The kind of concept, which can be `dataset` (a table or view), `metric` (a measure), or `glossary` (a business term or rule). All context created in the editor (not imported) is saved as `type: glossary`.
* **title**–The name of the concept as it appears in the context graph.
* **semanticType**–Your own sub-classification, in free text (for example, `fact_table`, `dimension`, or `kpi`). Connect AI stores it with the concept but does not use it for grouping or matching.
* **synonyms**–Other names users might type when asking about this concept. Include the words your users actually use.

In the body of the template:

* **Heading and Description**–Tell the MCP server what the concept covers and when it is relevant.
* **Related**–Other concepts this one depends on or explains.
* **Columns** (datasets only)–The fields that carry meaning, with descriptions. Remove this section for a glossary term or metric.

The following example shows a completed context file for a Jira Issues dataset.

```text wrap theme={null}
---
type: dataset
title: Jira Issues
semanticType: fact_table
synonyms:
  - tickets
  - tasks
  - bugs
  - stories
---

# Jira Issues

Contains all issues tracked in Jira, including bugs, tasks, stories, and epics.
Use this dataset to query issue status, assignments, priorities, and project breakdowns.

## Related

- Jira Projects
- Jira Users

## Columns

- **issue_key**—unique identifier for the issue (for example, PROJ-123)
- **summary**—short description of the issue
- **status**—current workflow state (for example, *To Do*, *In Progress*, *Done*)
- **assignee**—the user assigned to the issue
- **priority**—severity level (for example, *High*, *Medium*, *Low*)
- **project**—the Jira project the issue belongs to
- **issue_type**—category of issue (for example, *Bug*, *Story*, *Epic*, *Task*)
```

## Delete Context

To delete a context document:

<Steps>
  <Step>
    Click the delete icon next to the individual concept. To delete all concepts for a connection, click the options menu (⋮) to the right of the connection and click **Delete**.
  </Step>

  <Step>
    In the confirmation dialog, click **Delete**. When you delete all context for a connection, the button is **Delete all**; the connection itself is not deleted. Deleting context cannot be undone.
  </Step>
</Steps>


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