Sanity Context

Context MCP source types

How the dataset and Knowledge Base source types differ, when each one fits, and where dataset embeddings bridge the two.

Sanity Context has two content source types, and they solve different problems. The dataset source type queries your Sanity dataset at request time. The Knowledge Base source type serves an index built from your material ahead of time (datasets, websites, and files). The source types you configure determine which tools Context MCP serves and how an agent finds an answer.

When to use a dataset source

Use the dataset source type when your content is structured and consistent, and the schema tells the agent where to look. "Size L latex gloves, under $200 a pallet" is a filter over product documents. It stays exact across hundreds of thousands of records, with no build step and nothing else to keep in sync.

If the content model is simple and you give the agent good schema hints, even a small model can be good at this.

An MCP endpoint with a dataset source needs a Studio (v5.1.0 or later) deployed for that project and dataset; deploy it with npx sanity@latest deploy. An MCP endpoint with only Knowledge Base sources doesn't.

When to use a Knowledge Base source

Use a Knowledge Base when locating the answer is the hard part. "Is this industrial latex food-safe?" may depend on a specification, a compliance memo, and a support article. The pre-generated index gives the agent a strong hypothesis about where the answer lives before it starts reading.

You can also add datasets to a Knowledge Base alongside websites and files. This is not the same as the dataset source type: the build reads the dataset, and the agent reads the resulting index rather than querying the dataset. Building from Sanity data also gives you somewhere to apply corrections. When an issue comes from conflicting content, fix the content in the dataset. The next build inherits the correction. See Knowledge Bases.

Content that sits between the two

In general, use the dataset source for tabular data and Knowledge Bases for knowledge. For cases in between, such as a catalog where useful details live in prose fields, enable dataset embeddings and stay with the dataset source type. GROQ can then combine structured filters with semantic similarity in the same query.

Enabling embeddings is how you cover that middle ground. An endpoint can also serve a dataset and Knowledge Bases together: the agent then gets both the dataset source tools and the Knowledge Base source tools, its initial context contains both the schema overview and the Knowledge Base outline, and it has to pick the right tool for each question.

When to enable embeddings

Enable embeddings when your agent needs to query content and won't be able to guess accurately the words or phrases to search for. Product catalogs, help content, and editorial articles are good candidates. Dataset embeddings carry their own costs and quotas; see Dataset Embeddings for details.

Semantic search only ranks; it doesn't filter

Change what an endpoint serves

You don't choose a source type on the endpoint directly. An MCP endpoint's sources determine what it serves: attach a dataset source and the endpoint serves the dataset source tools; attach only Knowledge Base sources and it serves the Knowledge Base source tools; attach both types and it serves the dataset source tools and the Knowledge Base source tools. An MCP endpoint can have one dataset source and several Knowledge Base sources. Changing the sources changes what the endpoint serves without touching the agent. See Configure a Context MCP endpoint.

Gotcha

Next steps

Was this page helpful?

Sanity logosanity.ioAll Systems Operational© Sanity 2026
Change site theme