Sanity Context

Context MCP tools

Every tool Context MCP serves, by source type, with what each one returns and when an agent reaches for it.

Context MCP serves a different tool set depending on the endpoint's source type. A dataset source exposes tools for reading your schema and querying documents; Knowledge Base sources expose tools for searching and reading pre-built entries. The initial_context tool is served for both. An endpoint with a dataset source and Knowledge Base sources serves every tool in both tables, and its initial context contains both the schema overview and the Knowledge Base outline. Most agents use several tools over the course of a single conversation.

Dataset source tools

ToolPurpose
initial_contextCompressed schema overview plus instructions for querying your content. The /initial-context HTTP endpoint can replace it
schema_explorerReturns detailed schema information for a specific type, including fields and references
groq_queryExecutes a GROQ query against the dataset, subject to any groqFilter in effect
array_field_readerReads large array fields and Portable Text content from a single document

Knowledge Base source tools

ToolPurpose
initial_contextThe outline of each Knowledge Base the endpoint serves. The /initial-context HTTP endpoint can replace it
knowledge_base_readReads the full content of one or more entries, by Knowledge Base id (the kb… value on the "Knowledge base id:" line above its outline in initial_context) and entry paths from the outline. Accepts up to 20 paths in one call
knowledge_base_searchSearches entry content by keyword and returns ranked entry paths, or the full entries. Use it when the outline alone doesn't show where an answer lives

Paths in the outline may carry a [core] or [peripheral] tag marking how central the entry is; untagged entries are standard. Read paths back verbatim. When several entries look relevant, read them in one call rather than sequentially. See Knowledge Bases for how a Knowledge Base is built and what the outline is.

Choose which tools your agent sees

An endpoint serves every tool its sources offer. To give your agent fewer, filter them in your client. The common case is dropping initial_context after inlining its payload into your system prompt; see Inline initial context into your system prompt.

List the tools on an endpoint

curl -X POST https://api.sanity.io/v2026-11-03/context/organizations/$ORGANIZATION_ID/mcp/$MCP_ENDPOINT_NAME \
  -H "Authorization: Bearer $SANITY_ORGANIZATION_TOKEN" \
  -H "Accept: application/json, text/event-stream" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

A successful response returns a JSON object with a result.tools array listing the tools available on that endpoint. If the request fails:

  • 401: the token is missing, invalid, or belongs to another organization.
  • 403 with JSON-RPC error -32007 (endpoint with a dataset source): the token is not an organization API token with Context Viewer permissions. Create one under Manage > API > Tokens at the organization level.
  • 403 with JSON-RPC error -32006 (endpoint with only Knowledge Base sources): the token has no read access to that Knowledge Base. Use an organization API token with Context Viewer permissions.

For the full error messages, see Authentication in Context MCP reference. See Content access and security.

Was this page helpful?

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