---
title: "Configure Metabot context"
description: "The metadata, content, and settings that change what Metabot can find and how it uses it."
url: "https://www.metabase.com/docs/latest/ai/configure-metabot-context"
version: "65"
---

# Configure Metabot context

Metabot answers questions using the metadata and content in your Metabase. This page lists what you can change to improve its answers, and what each change does.

## What Metabot searches depends on where people use it

Metabot can only see what the person asking has [permission](https://www.metabase.com/docs/latest/permissions/data.md) to see.

| Where                                                       | What Metabot searches                                                                                                                                                                                                              |
| ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Chat sidebar](https://www.metabase.com/docs/latest/ai/metabot.md#the-metabot-chat-sidebar)       | Tables, models, metrics, measures, segments, questions, dashboards, and documents the person has permission to see, plus their recently viewed items.                                                                              |
| [AI exploration](https://www.metabase.com/docs/latest/ai/metabot.md#ai-exploration)               | The [Library](#publish-tables-and-metrics-to-the-library), if you have one. Otherwise, the [collection for natural language querying](#without-a-library-point-ai-exploration-at-a-collection).                                    |
| [SQL generation](https://www.metabase.com/docs/latest/ai/metabot.md#metabot-in-the-native-editor) | Tables in the database selected in the SQL editor.                                                                                                                                                                                 |
| [Documents](https://www.metabase.com/docs/latest/documents/introduction.md) (**Ask Metabot**) | Models and metrics in the [collection for natural language querying](#without-a-library-point-ai-exploration-at-a-collection), or all models and metrics if you haven't set one. To write SQL, the database the person @-mentions. |

Metabot also sees the item the person has open, any items they @-mention, and your [glossary](#define-company-terms-in-the-glossary).

In documents, **Ask Metabot** can only build a chart, so Metabot doesn't search tables, questions, or dashboards, and it ignores recently viewed items. Metabot prefers an existing model or metric, and only writes SQL if none fits or when directly asked for SQL. To write SQL, @-mention exactly one database.

## Add descriptions to tables, columns, models, and metrics

Metabot can read item descriptions (including when searching for stuff). In your descriptions:

- Say what the item means to your business and which questions it answers.
- Explain columns that are easy to misread: codes, flags, anything called `status`, and anything with an internal encoding. (Metabot already knows the column types, though).
- Include the names people use for the item outside your database. Metabot can't know these on its own.

For example, here's a useful description for an ID column:

```txt
Unique ID for the product. Customer-facing emails and screens call this the "Invoice number" or "Confirmation number".
```

You can ask Metabot to draft descriptions, but be careful with this; Metabot only knows what's in your database. It can't know that this ID is called the "Invoice number" in your app, which is exactly the kind of context worth writing down.

Admins and data analysts can edit table and column descriptions in [Data Studio](https://www.metabase.com/docs/latest/data-modeling/metadata/managing-tables.md). To add descriptions to a model's columns, see [Add metadata to columns in a model](https://www.metabase.com/docs/latest/data-modeling/models/models.md#add-metadata-to-columns-in-a-model).

## Define company terms in the glossary

Add acronyms, product names, and terms with a company-specific meaning to the [glossary](https://www.metabase.com/docs/latest/data-modeling/semantic-layer/glossary.md) in **Data Studio > Glossary**.

- Metabot gets the glossary with every message, in every place people use Metabot.
- Metabot only gets the 100 most recently updated terms.
- Keep definitions short, since they're sent with every message.

For example, if you define "active customer" as "logged in during a quarter", Metabot knows what people mean when they ask "How many active customers did we have over the last four quarters?"

## Mark foreign keys so Metabot can join tables

When a column's [semantic type](https://www.metabase.com/docs/latest/data-modeling/metadata/metadata-editing.md#semantic-type) is **Foreign Key** and points to a column in another table, Metabot sees which table and column it links to. Without that, Metabot sees a column like `customer_id` with no hint that it joins anywhere, and may look for customer fields in the wrong table.

Metabase picks up foreign keys that your database defines as constraints. Many databases don't define them, so check the columns people join on most. Metabot doesn't see other semantic types, like **Creation date** or **Category**.

## Define measures and segments for calculations people get wrong

If people calculate "net revenue" or filter for "active customers" in slightly different ways, define the calculation once as a [measure](https://www.metabase.com/docs/latest/data-modeling/semantic-layer/measures.md) or [segment](https://www.metabase.com/docs/latest/data-modeling/semantic-layer/segments.md) on the table.

When Metabot looks at a table, it sees the table's measures and segments and is instructed to use them instead of writing its own calculation. Metabot also searches for measures and segments by name, especially when a question names a rate ("churn rate") or a group ("active customers").

## Curate the sources you want Metabot to use

When more than one source could answer a question, Metabot picks the most curated one: [Metrics](https://www.metabase.com/docs/latest/data-modeling/semantic-layer/metrics.md)** are preferred for calculations. [Models](https://www.metabase.com/docs/latest/data-modeling/models/models.md)** serve as a fallback when no matching metric is found. Build a metric if you want Metabot to reuse a calculation.

Metabot will respond with an existing **question** if it directly answers the question. **Tables** rank higher if they're [published](https://www.metabase.com/docs/latest/data-modeling/semantic-layer/published-tables.md) or their visibility layer is **Final** rather than **Internal**. **[Verified](https://www.metabase.com/docs/latest/exploration-and-organization/content-verification.md)** items and items in [official collections](https://www.metabase.com/docs/latest/exploration-and-organization/collections.md#official-collections) also count as endorsed.

Old and abandoned content also competes in Metabot's search results. To find items to clean up, check the [Content with cobwebs](https://www.metabase.com/docs/latest/usage-and-performance-tools/usage-analytics-reference.md#content-with-cobwebs) dashboard in Usage analytics and **Content diagnostics** in [Monitor](https://www.metabase.com/docs/latest/monitor/start.md). Then [clear out unused items](https://www.metabase.com/docs/latest/exploration-and-organization/collections.md#cleaning-up-collections) from your collections.

## Hide tables and columns nobody should query

- **Tables**: In **Data Studio > Connected data**, set the table's [visibility layer](https://www.metabase.com/docs/latest/data-modeling/metadata/managing-tables.md#visibility-layer) to **Hidden**. Hidden tables don't show up in Metabot's search or in the tables it considers for SQL, and Metabot can't build query-builder questions on them. Hidden tables also disappear from the query builder and stop syncing.
- **Columns**: Set the column's [visibility](https://www.metabase.com/docs/latest/data-modeling/metadata/metadata-editing.md#field-visibility) to **Do not include**. Metabot never sees these columns. They also disappear from the query builder.

Neither setting is a permission: people can still query hidden tables and columns with SQL. To control what data Metabot view and query, use [data permissions](https://www.metabase.com/docs/latest/permissions/data.md).

## Show Metabot real values for columns people filter on

Metabot can only look up a column's values if the column's [Filtering](https://www.metabase.com/docs/latest/data-modeling/metadata/metadata-editing.md#filtering) setting is **A list of all values**. With **Search box** or **Plain input box**, Metabot only gets summary statistics, so it has to guess what values like `churned` or `EMEA` look like in your data.

Use **A list of all values** for columns that people filter on by name, like statuses, categories, and region codes. This setting also changes the filter widget people see.

## Restrict Metabot to curated content

> Verified or curated content is only available on [Pro](https://www.metabase.com/product/pro) and [Enterprise](https://www.metabase.com/product/enterprise) plans (both self-hosted and on Metabase Cloud).

In **Admin > AI**, on the **Internal** tab, turn on **Only use verified or curated content**. Metabot's search results, recently viewed items, suggested prompts, and the models and metrics **Ask Metabot** uses in documents then only include content that's:

- [Verified](https://www.metabase.com/docs/latest/exploration-and-organization/content-verification.md).
- In an [official collection](https://www.metabase.com/docs/latest/exploration-and-organization/collections.md#official-collections).
- Published to the [Library](https://www.metabase.com/docs/latest/data-modeling/semantic-layer/library.md). Published tables only count if their visibility layer is **Final**.

Turn this on only once you've curated enough content. If nothing qualifies, Metabot's searches come back empty. See [Verified or curated content](https://www.metabase.com/docs/latest/ai/settings.md#verified-or-curated-content).

## Publish tables and metrics to the Library

> Publishing tables to the Library is only available on [Pro](https://www.metabase.com/product/pro) and [Enterprise](https://www.metabase.com/product/enterprise) plans (both self-hosted and on Metabase Cloud).

If your Metabase has a [Library](https://www.metabase.com/docs/latest/data-modeling/semantic-layer/library.md), AI exploration searches it first, matching questions against each item's name and description.

- [Publish tables](https://www.metabase.com/docs/latest/data-modeling/semantic-layer/published-tables.md) in **Data Studio > Semantic layer**.
- Move metrics into the **Library > Metrics** collection.
- Add descriptions to everything you publish.

The Library only holds tables, metrics, dashboards, and SQL snippets.

AI exploration can still look at tables outside the Library, but it starts with what's in the Library. If nothing in the Library matches a question well, Metabot may ask the person to clarify instead of guessing.

## Without a Library, point AI exploration at a collection

In **Admin > AI**, on the **Internal** tab, set **Collection for natural language querying** to a collection with your best models and metrics. AI exploration then only searches that collection and its subcollections. **Ask Metabot** in documents also only picks models and metrics from that collection, whether or not you have a Library. People can still @-mention items outside it. See [Collection for natural language querying](https://www.metabase.com/docs/latest/ai/settings.md#collection-for-natural-language-querying).

## Use system prompts for conventions, not facts

> AI system prompts are only available on [Pro](https://www.metabase.com/product/pro) and [Enterprise](https://www.metabase.com/product/enterprise) plans (both self-hosted and on Metabase Cloud).

In **Admin > AI > System prompts**, you can write separate instructions for **AI chat**, **Natural language queries**, and **SQL generation**. Metabot gets the matching prompt with every message. **Ask Metabot** in documents doesn't use any of these prompts.

- **Good for**: tone, formatting, and conventions that always apply, like "Our fiscal year starts on February 1."
- **Not for**: facts about specific tables or columns. Put those in descriptions, which Metabot only reads when it uses that item.

Keep system prompts short. See [AI system prompts](https://www.metabase.com/docs/latest/ai/system-prompts.md).

## Open the item before asking about it

When a table, model, or question is open, Metabot sees its columns and their descriptions, its measures and segments, and the tables it joins to. Opening the right item first is the most direct way to point Metabot at the right data.

In the chat sidebar, Metabot also sees recently viewed items, so viewing a relevant table or question first helps. AI exploration and **Ask Metabot** in documents ignore recently viewed items.

Documents are an exception to this: when a document is open, the chat sidebar doesn't see what's in it. Metabot can still find a document by searching for it, so mention the document's name in your question if needed.

## Some changes don't affect Metabot

- **Table display names**: Metabot works with a table's database name, not its display name. Search does match display names, though, so a good display name still helps Metabot find the table. Column display names do reach Metabot.
- **Why this table is interesting** and **Things to be aware of about this table** in [Data Reference](https://www.metabase.com/docs/latest/exploration-and-organization/data-model-reference.md): Metabot never sees these, put that information in the description instead.
- **Verification doesn't add content to the Library.** Verified items count as curated content, but only publishing or moving an item puts it in the Library.
