The Sanity remote Model Context Protocol (MCP) connector in Optimizely Opal lets you manage and automate every stage of your content lifecycle. You can interact with your datasets and project settings to streamline high-velocity tasks, for example, authorizing CORS origins, restoring archived drafts, and triggering asynchronous AI image generation. These tools are designed to reduce friction between your CMS and your Opal workflows, providing specialized utilities for semantic search, schema deployment, and robust document patching directly within the Opal interface.
First, an Opal administrator must Connect the Sanity Remote MCP to Opal. After adding the MCP server, individual Opal users and agent builders log in to Sanity to access their information from Opal. Administrators need to add the Sanity remote MCP only once.
Connect the Sanity remote MCP to Opal
To connect the Sanity remote MCP to Opal, complete the following steps as an Opal administrator:
- Go to Tools > Connectors in Opal.
-
Click Add Remote MCP.
- Click Sanity.
- Click Next.
- Click Connect to Sanity.
- Complete required access configuration in the pop-up window.
- Click Accept.
The Sanity tile is now available on the Connectors tab for users to authenticate with their personal accounts.
Authenticate with Sanity
After an administrator connects the Sanity remote MCP to Opal, you can log in to Sanity. User-level authentication ensures Opal users and agent builders can access only their authorized Sanity data.
To authenticate, complete the following steps in Opal:
- Go to Tools > Connectors.
- Click Connect for Sanity.
- Log in to Sanity.
After you connect to Sanity, the Sanity connector tools become available in Opal Chat, agents, and workflows.
Sanity connector tools
After an administrator connects Sanity remote MCP to Opal and you log in to Sanity, the following tools are available in Opal. Click a tool name to expand it and view usage guidance, parameters, and example prompts. If you do not provide a required parameter, Opal prompts you for it.
Before running any other tools, run the `list_sanity_rules` tool.
list_sanity_rules – List available best practice rules for Sanity development.
-
When to use
- Before performing any Sanity development work to see which best practice rules are available.
- As the first step to identify rules for schemas, queries, frameworks, and visual editing.
-
Parameters
- None.
-
Example prompts
- List all available best practice rules for schema development and GROQ queries.
- Show me the current set of visual editing and framework rules supported by the MCP server.
- Browse the library of Sanity development rules before loading specific configurations.
AI and images
generate_image – Generate a new image in a document using AI. When targeting a published document, this tool creates or updates a draft with the generated image. For image arrays, this tool automatically adds a new array item.
-
When to use
- Create new visual content directly within a Sanity document using AI.
-
Parameters
-
documentId– The ID of the document containing the image. -
imagePath– Path to the image field in the document (for example, "image", "hero.image", or "images"). For arrays of images, provide the array field name and a new image is added automatically. -
instruction– Natural language instructions for generating the image. Acts like a prompt telling the internal Sanity AI what to do. Describe the complete image to create (for example, "A serene mountain landscape at dawn with misty valleys"). Keep instructions clear and specific for best results. -
resource– Resource information indicating which project ID and dataset to target. - (Optional)
intent– Briefly explain why you are making this tool call — the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps us understand usage patterns and improve the tools. - (Optional)
workspaceName– Workspace name derived from the manifest, not document type. Derived from context or list_workspace_schemas.
-
-
Example prompts
- Generate an image of a futuristic skyline at sunset for the hero.image field in document main-page-01.
- Create a professional headshot of a fictional team member and add it to the team-gallery array in document corp-about-us.
- Produce a minimalist vector illustration of a lightbulb to represent innovation for the feature-icon field in document services-overview.
list_embeddings_indices – List all available embeddings indices for a dataset.
-
When to use
- Discover available vector search indices.
- Use this before performing semantic search tasks to ensure you are targeting the correct index.
-
Parameters
-
resource– Resource information indicating which project ID and dataset to target. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. For example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools.
-
-
Example prompts
- List all embedding indices for my current production dataset.
- Check which vector search indices are available for the staging dataset.
- Retrieve the names of all active embeddings indices in the project.
transform_image – Transform an existing image in a document using AI. When targeting a published document, this tool creates or updates a draft with the transformed image.
-
When to use
- Modify an existing image using AI instructions.
- Change specific visual elements, for example, lighting or background, while preserving the original document state.
-
Parameters
-
documentId– The ID of the document containing the image. -
imagePath– Path to the image field in the document (for example, "image" or "hero.image"). For image arrays, target with_keyfiltering:images[_key==\"img1\"]. -
instruction– Natural language instructions for transforming the image. Acts like a prompt telling the internal Sanity AI what to do. Describe the desired changes (for example, "Make the background more vibrant and add warm sunset lighting"). Keep instructions clear and specific for best results. -
resource– Resource information indicating which project ID and dataset to target. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools. - (Optional)
workspaceName– Workspace name derived from the manifest, not document type. Derived fromcontextorlist_workspace_schemas.
-
-
Example prompts
- Transform the background of the hero image in document blog-post-99 to be a blurred urban street scene.
- Adjust the lighting of the product photo at field main-image in document product-xyz to be warmer and more cinematic.
- Apply an artistic sketch filter to the image found in field profile-pic for document user-profile-01.
Content operations
create_documents_from_json – Create one or more draft documents using JSON content. By default, documents are created with a "drafts." prefix.
-
When to use
- Create new draft documents by providing their content in JSON format.
- Create versioned documents for a specific release by providing a releaseId.
-
Parameters
-
documents– Array of documents to create. Each document must have a type and content. -
resource– Resource information indicating which project ID and dataset to target. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools. - (Optional)
releaseId– Optional release ID for creating versioned documents. If provided, documents are created under the specified release version instead of as drafts. - (Optional)
workspaceName– Workspace name derived from the manifest, not document type. Derived fromcontextorlist_workspace_schemas.
-
-
Example prompts
- Create three new blog post drafts using these JSON objects in the production dataset.
- Establish new product documents in the master space from the provided JSON content.
- Generate versioned documents for release rel_123 using this JSON payload in the staging environment.
create_documents_from_markdown – Create one or more draft documents from Markdown. By default, documents are created with a "drafts." prefix.
-
When to use
- Create new draft documents using Markdown content.
- Create versioned documents for a specific release by providing a releaseId.
-
Parameters
-
documents– Array of documents to create. Each document must have a type and Markdown content. -
resource– Resource information indicating which project ID and dataset to target. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools. - (Optional)
releaseId– Optional release ID for creating versioned documents. If provided, documents are created under the specified release version instead of as drafts. - (Optional)
workspaceName– Workspace name derived from the manifest, not document type. Derived fromcontextorlist_workspace_schemas.
-
-
Example prompts
- Create a new post draft from this Markdown text in my Sanity space.
- Initialize several draft documents in the staging dataset using these Markdown strings.
- Generate a versioned article for the spring release using the provided Markdown content.
create_release – Create a new release for grouping and coordinated publishing.
-
When to use
- Create a new container for holding versioned documents.
- Coordinate the publishing of multiple content changes.
-
Parameters
-
resource– Resource information indicating which project ID and dataset to target. -
title– Human-readable title for the release (for example, "Q1 2024 Product Updates"). - (Optional)
description– Description of the release. - (Optional)
intendedPublishAt– ISO 8601 date for when the release is intended to be published. Only relevant for "scheduled" release type. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools. - (Optional)
releaseType– Release type.asapto publish immediately when ready,scheduledfor a specific date, orundecided(default).
-
-
Example prompts
- Establish a new release titled Holiday Season Launch in the production dataset.
- Create a scheduled release for April 30th to group my upcoming site updates.
- Define a new release named Summer Campaign with the undecided release type in the master space.
create_version – Create a version document for a specific scheduled release. If instructions are omitted, the tool creates an exact copy of the source document in the release.
-
When to use
- Create version documents (
versions.{releaseId}.*prefix) for a specific release. - Make content updates, rewrites, or improvements for a release using AI instructions.
- Create version documents (
-
Parameters
-
documentIds– Array of document IDs to create versions for. The minimum is 1. The maximum is 10. -
releaseId– ID of the release to associate this version with. -
resource– Resource information indicating which project ID and dataset to target. - (Optional)
instruction– Natural language instruction for internal Sanity AI to modify the document while creating the version. Use this to make content updates, rewrites, or improvements (for example, "Update all dates to 2025", "Make the tone more formal", "Translate technical terms to plain language"). If omitted, the tool creates an exact copy of the source document. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools. - (Optional)
workspaceName– Workspace name derived from the manifest, not document type. Derived fromcontextorlist_workspace_schemas.
-
-
Example prompts
- Create versions of these three post IDs for release holiday-2024 with instructions to update the dates.
- Add a formal version of the primary terms document to the scheduled policy release.
- Generate a direct copy of the homepage document in the upcoming major update release.
discard_drafts – Discard one or more draft documents.
-
When to use
- Remove draft documents while leaving the published version intact.
- Cleaning up unwanted drafts in your workspace.
-
Parameters
-
ids– Document IDs to discard drafts for. -
resource– Resource information indicating which project ID and dataset to target. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools.
-
-
Example prompts
- Discard the drafts for these five outdated entries in the master dev space.
- Cleanup my production environment by removing all drafts associated with the specified IDs.
- Remove the pending draft for the about-us page without affecting the live content.
list_releases – List active, scheduled, or archived releases in a dataset.
-
When to use
- Browse all releases currently configured in a dataset.
- Find specific release IDs or check the status of planned publishing workflows.
-
Parameters
-
resource– Resource information indicating which project ID and dataset to target. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools. - (Optional)
limit– Maximum number of releases to return. - (Optional)
offset– Number of releases to skip for pagination. - (Optional)
state– Filter releases by state. If omitted, returns active and scheduled releases (excludes published and archived).
-
-
Example prompts
- Fetch a list of all active and scheduled releases in the production dataset.
- Show me the first ten archived releases from the master space to review history.
- Retrieve all releases in the staging environment to find the ID for the next launch.
patch_document_from_json – Apply precise field modifications using JSON. When targeting a published document, this tool creates or updates a draft (preserving the live version).
-
When to use
- Make specific field updates or structural changes to a document using JSON.
- Destructive operations like "set" or "unset", and for "append" operations on arrays.
-
Parameters
-
documentId– Document ID to patch. For drafts usedrafts.prefix (for example,drafts.myDocId). For published use ID directly. -
resource– Resource information indicating which project ID and dataset to target. - (Optional)
append– Adds items to the end of an array. Can only append to arrays that already exist. Each operation targets one specific array. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools. - (Optional)
releaseId– Release ID for patching within a specific release. Omit for standard drafts. - (Optional)
set– Batched operation that replaces field values at specified paths. Can set fields that do not exist yet. Scope matters assetis destructive. - (Optional)
unset– Removes fields and array items from the document. Specify only what to remove. - (Optional)
workspaceName– Workspace name derived from the manifest, not document type. Derived fromcontextorlist_workspace_schemas.
-
-
Example prompts
- Set the price field to 19.99 for product book_1 in the master dataset.
- Append a new reference to the relatedPosts array in the draft for post_456.
- Unset the temporary metadata field for document entry_xyz in production.
patch_document_from_markdown – Patch a specific field in a document using Markdown. The content is automatically converted to the correct structure based on the target field's schema.
-
When to use
- Update a single field in a document by providing content in Markdown.
-
Parameters
-
documentId– The ID of the document to patch. -
markdown– Markdown content to apply to the target field. The content is converted to the appropriate structure based on the target field schema. -
path– Path to the field to update (for example,bioorhero.contents). -
resource– Resource information indicating which project ID and dataset to target. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools. - (Optional)
releaseId– Release ID for patching versioned documents. If provided, the document in the specified release will be patched. - (Optional)
workspaceName– Workspace name derived from the manifest, not document type. Derived fromcontextorlist_workspace_schemas.
-
-
Example prompts
- Update the bio field in document profile-001 using this Markdown introduction.
- Replace the contents of the main-article section with the provided Markdown text in staging.
- Patch the hero.copy field in production for document home_page using the new Markdown snippet.
publish_documents – Publish one or more draft documents to make them live.
-
When to use
- Make draft documents live for public access.
- When you have finished editing a draft and are ready to deploy it.
-
Parameters
-
ids– IDs of the documents to publish. -
resource– Resource information indicating which project ID and dataset to target. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", or "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools.
-
-
Example prompts
- Publish the drafts for these three new blog posts in my production dataset.
- Make document product_entry_01 live by publishing it in the master space.
- Deploy the pending draft updates for my entire FAQ catalog to the public delivery API.
unpublish_documents – Move live documents back to drafts. This tool cannot unpublish documents that are referenced by other documents. References must be removed or updated first.
-
When to use
- Take live documents offline and move them back to draft status.
-
Parameters
-
ids– IDs of the documents to unpublish (published document IDs only). -
resource– Resource information indicating which project ID and dataset to target. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", or "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools.
-
-
Example prompts
- Unpublish the old landing page document to move it back to drafts in staging.
- Remove these three obsolete announcements from the live site by unpublishing them.
- Take the seasonal promo document offline in the production environment.
version_discard – Discard one or more document versions from a release.
-
When to use
- Remove specific document versions from a planned release.
- When a content change is no longer intended to be part of a coordinated publishing event.
-
Parameters
-
ids– Document IDs to discard from the release. -
releaseId– ID of the release to discard the document versions from. -
resource– Resource information indicating which project ID and dataset to target. - (Optional)
intent– Briefly explain why you are making this tool call — the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", or "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools.
-
-
Example prompts
- Discard these two post versions from the upcoming Q2 Marketing launch release.
- Remove document version article_001 from release rel_summer_2024 in the production dataset.
- Cancel the inclusion of the price-update version from my scheduled release.
version_replace_document – Replace a document version with content from another document.
-
When to use
- Update a version's content by copying it from a different document.
- Synchronize content across different release streams.
-
Parameters
-
id– ID of the published document. -
releaseId– ID of the release that contains this document version. -
resource– Resource information indicating which project ID and dataset to target. -
sourceDocumentId– ID of the document to copy contents from. -
type– Parameter: type. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", or "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools.
-
-
Example prompts
- Replace the hero version in my new-campaign-release with content from the staging homepage document.
- Apply the latest version of terms-of-service from production to my scheduled policy release.
- Synchronize the versioned article in the upcoming release with another existing document's content.
version_unpublish_document – Mark a document to be unpublished when a release runs.
-
When to use
- Include an unpublishing action as part of a release workflow.
- When content needs to be removed from live status at the same time other content is published.
-
Parameters
-
id– ID of the published document. -
releaseId– ID of the release that contains this document version. -
resource– Resource information indicating which project ID and dataset to target. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", or "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools.
-
-
Example prompts
- Mark the temporary promo page to be unpublished when my main winter release is executed.
- Include an unpublishing event for ID news_entry_001 in the scheduled spring release.
- Set the live announcement document to unpublish automatically when the coordinated release runs in production.
Development and schema
deploy_schema – Deploy a schema to cloud for projects without a local Sanity Studio.
-
When to use
- Deploy schema types iteratively to the cloud.
- Add or overwrite types for projects that do not use a local Sanity Studio.
-
Parameters
-
resource– Resource information indicating which project ID and dataset to target. -
schemaDeclaration– Sanity schema declaration using literal values only. Multiple types can be declared by appending objects. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools. - (Optional)
workspaceName– Workspace name derived from the manifest, not document type; derived fromcontextorlist_workspace_schemas.
-
-
Example prompts
- Deploy the author document type to my cloud project cloud-123 in the production dataset.
- Update the article schema iteratively to include a new publishedDate field for the news dataset.
- Overwrite the existing category document type with a refined structure in the development resource.
get_sanity_rules – Load specific development rules for schemas and queries.
-
When to use
- Load Sanity development rules after checking availability with
list_sanity_rules. - Load all rules relevant to your current task in a single call.
- Load Sanity development rules after checking availability with
-
Parameters
-
rules– One or more rule names to load.
-
-
Example prompts
- Load the best practice rules for schema definitions to ensure my structured content project follows standard patterns.
- Retrieve the development rules for frameworks and queries in a single call to optimize my Sanity workspace.
- Import the visual editing rules into my current session to support advanced studio configuration.
get_schema – Get the full schema of the current Sanity workspace.
-
When to use
- Retrieve the complete schema definition for a specified Sanity workspace.
- When you need detailed field definitions for a specific content type.
-
Parameters
-
resource– Resource information indicating which project ID and dataset to target. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools. - (Optional)
type– Specific type name to fetch. If you do not provide atype, the tool returns the full schema without detailed field definitions. - (Optional)
workspaceName– Workspace name derived from the manifest, not document type; derived fromcontextorlist_workspace_schemas.
-
-
Example prompts
- Get the full schema for my Sanity project to verify all current document types and field definitions.
- Fetch the detailed field definitions for the author type in the master workspace for validation.
- Retrieve the current workspace schema from the production dataset for project data-analysis-01.
list_workspace_schemas – Get a list of all available workspace schema names.
-
When to use
- Find all accessible workspace schema names within a project and dataset.
-
Parameters
-
resource– Resource information indicating which project ID and dataset to target. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools.
-
-
Example prompts
- Get a list of all workspace schema names configured for the project core-platform in dataset v1.
- Show me all available schema names across my production dataset to verify naming conventions.
- Retrieve workspace schema options to find the correct name for the get_schema tool.
Project and organization administration
add_cors_origin – Add CORS origins to let your Sanity project run client-side requests.
-
When to use
- Authorize a specific origin (for example, a development server or a production domain) to make requests to your Sanity project.
- Enable Studio hosting or authenticated API requests from a web application.
-
Parameters
-
origin– The CORS origin to allow, in formatprotocol://hostname[:port]. Wildcards (*) are supported for subdomains. -
resource– Resource information indicating which project ID and dataset to target. - (Optional)
allowCredentials– Allow authenticated requests from this origin. Required for hosting a Studio or making authenticated API requests. Defaults to true.
-
-
Example prompts
- Authorize the origin http://localhost:3000 to interact with my Sanity production dataset.
- Add a wildcard CORS origin for my Lovable preview apps to project proj-123.
- Enable CORS for my production domain https://www.example.com and allow credentials.
create_dataset – Create a new dataset with specified name and access settings.
-
When to use
- Establish a new storage partition for your project data.
- When initializing a new environment, for example, a dedicated dataset for testing or a specific content branch.
-
Parameters
-
datasetId– The unique name for the new dataset. -
resource– Resource information indicating which project ID and dataset to target. - (Optional)
aclMode– Access control settings for the new dataset. - (Optional)
description– A brief description of the dataset purpose.
-
-
Example prompts
- Create a new dataset named staging for my Sanity project.
- Initialize a private dataset called dev-01 with specific access control settings.
- Establish a new dataset for my project using the ID v2-content.
create_project – Create and initialize a new Sanity project.
-
When to use
- Generate an entirely new Sanity project within a specified organization.
- Quickly initialize a project with a default dataset and API tokens.
-
Parameters
-
displayName– The display name for the new project. -
organizationId– Organization ID to create the project in. - (Optional)
allowCredentials– Allow authenticated requests from the specified origin. Defaults to true. - (Optional)
corsOrigin– Initial CORS origin to allow for hosting the Studio or development.
-
-
Example prompts
- Create a new Sanity project named Marketing Website in my primary organization.
- Initialize a new project called Portfolio and authorize http://localhost:3000 as a CORS origin.
- Set up a new project in organization org_xyz for a product catalog relaunch.
get_project_studios – Retrieves all studio applications linked to a specific Sanity project.
-
When to use
- Identify which Sanity Studio instances are connected to and authorized for your project.
- Audit your active studio distributions and their URLs.
-
Parameters
-
resource– Resource information indicating which project ID and dataset to target.
-
-
Example prompts
- Retrieve all studio applications associated with project proj-abc.
- Show me a list of linked studio instances for my production environment.
- List the studio hosts currently connected to my master project workspace.
list_datasets – List all datasets in your Sanity project.
-
When to use
- See all available datasets (for example, production, staging, or test) within a project.
- Verify dataset names before performing document or schema operations.
-
Parameters
-
resource– Resource information indicating which project ID and dataset to target.
-
-
Example prompts
- List all datasets configured for the Sanity project with ID project_123.
- Show me the available datasets in my current project workspace.
- Fetch a list of datasets to identify the correct target for my content migration.
list_organizations – List all organizations you have access to.
-
When to use
- Discover which Sanity organizations you are a member of.
- Find Organization IDs required for creating new projects or administrative tasks.
-
Parameters
- None.
-
Example prompts
- Show me all the Sanity organizations I have access to.
- List my organizations to find the ID for my new project setup.
- Retrieve a list of organizations linked to my authenticated account.
list_projects – List all Sanity projects associated with your account.
-
When to use
- Get a full list of projects you can manage.
- Verify project IDs or display names across your entire Sanity account.
-
Parameters
- None.
-
Example prompts
- Show me all projects associated with my account.
- List every project I have permission to manage in Sanity.
- Fetch the full list of projects to locate the ID for the news site project.
update_dataset – Modify a dataset's name or access control settings.
-
When to use
- Rename an existing dataset or update its permissions.
- When you need to change the public or private status of a dataset.
-
Parameters
-
resource– Resource information indicating which project ID and dataset to target. - (Optional)
aclMode– Updated access control settings for the dataset. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. for example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools. - (Optional)
description– A brief description of the dataset purpose. Pass null to clear.
-
-
Example prompts
- Update the name of dataset old-staging to staging-v2.
- Change the access control settings for the production dataset in project pj-999.
- Modify the permissions for my developer dataset to make it private.
whoami – Verify information about the currently authenticated Sanity user.
-
When to use
- Verify the identity and permissions of the account currently linked to the MCP session.
- Troubleshooting access issues or confirming your Sanity user ID.
-
Parameters
- None.
-
Example prompts
- Show me the current authenticated user's details for this session.
- Verify who I am currently logged in as within the Sanity environment.
- Check user information to troubleshoot a permission error in my project.
Search and retrieval
get_document – Fetch a single document by its exact ID (lookup only). This is a direct ID lookup tool only. It does not search, filter, or query.
-
When to use
- When you have a specific document ID and need its full content.
-
Parameters
-
documentId– The exact document ID to fetch. Must be a complete, known document ID (for example, "movie-123" or "drafts.article-456"). -
resource– Resource information indicating which project ID and dataset to target. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. For example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools.
-
-
Example prompts
- Fetch the raw document data for document ID drafts.intro-post in the production dataset.
- Lookup the content for document prod-about-page to verify its existing fields.
- Retrieve the full technical document identified by the ID site-settings-01.
query_documents – Query documents using the GROQ query language.
-
When to use
- Perform advanced searches or data retrieval tasks using the GROQ query language.
- Filter, slice, or transform multiple documents in a single request.
-
Parameters
-
query– Complete GROQ query (for example*[_type == \"post\"][0...10]{title, _id}). -
resource– Resource information indicating which project ID and dataset to target. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. For example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools. - (Optional)
limit– Maximum number of documents to return. - (Optional)
params– Parameters for the GROQ query. - (Optional)
perspective– The perspective to query from. Options include:raw,drafts,published, or a release ID. - (Optional)
single– Whether to return a single document or a list.
-
-
Example prompts
- Query the first ten published posts return their titles and IDs using a GROQ query.
- Find all draft documents of type author and list their names for audit.
- Execute a GROQ search to retrieve products with a price greater than fifty in the master space.
semantic_search – Perform a semantic search on an embeddings index.
-
When to use
- Find documents that are conceptually similar to a natural language search query.
- Content discovery tasks where exact keyword matching is insufficient.
-
Parameters
-
indexName– The name of the embeddings index to search. -
query– The search query to find semantically similar content. -
resource– Resource information indicating which project ID and dataset to target. - (Optional)
intent– Briefly explain why you are making this tool call, the high-level goal, not the specific operation. For example, "migrating content from legacy CMS", "building a product catalog for launch", "cleaning up orphaned references after schema change". This helps Sanity understand usage patterns and improve the tools. - (Optional)
limit– Maximum number of results to return.
-
-
Example prompts
- Find semantically similar articles using the query high quality content marketing on the primary embeddings index.
- Search for documents related to cloud infrastructure using vector search in the production dataset.
- Perform an AI search for content describing modern sunlit offices using the internal embeddings index.
Documentation and guidance
migration_guide – Get guidance for migrating from other CMS platforms. Supports analyzing existing content structures, designing Sanity schemas, and platform-specific migration data.
-
When to use
- When you want to migrate their existing CMS or content system to Sanity.
-
Parameters
-
guide– The type of migration guide to retrieve. Usegeneralfor a high-level Sanity migration guide,schema.{platform}for a platform-specific guide for migrating schemas to Sanity, orcontent.{platform}for a platform-specific guide for migrating content to Sanity.
-
-
Example prompts
- Retrieve a platform-specific guide for migrating content from Contentful to Sanity.
- Get the general high-level Sanity migration guide to understand the overall project workflow.
- Fetch a guide for designing Sanity schemas based on an existing WordPress structure.
sanity_read_docs – Read a specific Sanity documentation article. Ideal for learning about technical concepts, framework integrations, or CLI commands.
-
When to use
- Load and read the full content of a specific Sanity documentation article.
-
Parameters
- (Optional)
path– The documentation path (for example,/docs/studio/installation). - (Optional)
url– Full URL to the documentation page (for example,https://www.sanity.io/docs/studio/installation).
- (Optional)
-
Example prompts
- Read the Sanity documentation article for studio installation to check prerequisites.
- Access the official documentation page using the URL for visual editing configuration.
- Load the article found at the path for GROQ tutorial to improve my query skills.
search_docs – Search through all Sanity documentation. Helps identify relevant articles when you do not have a specific path or URL.
-
When to use
- Search for specific terms or topics across all official Sanity documentation.
-
Parameters
-
query– The search query for documentation. - (Optional)
limit– Maximum number of results to return (default: 10, max: 50).
-
-
Example prompts
- Search official Sanity documentation for articles related to Model Context Protocol configuration.
- Find documentation about schema validation rules and limit the results to five items.
- Search for tutorials on building custom input components within Sanity Studio.
If you use Opti ID, administrators can turn off generative AI in the Opti ID Admin Center. See Turn generative AI off across Optimizely applications.
Article is closed for comments.