Tools
This is a reference catalogue. Tools cannot be configured or run from this page.
Deploy schema
SANITY_MCP_DEPLOY_SCHEMAOnly use `deploy_schema` when no local Sanity Studio project exists. Coding agents must inspect the current working directory for `sanity.config.*` or `sanity.cli.*` and confirm none exist; an empty remote schema is not confirmation. MCP-only agents may use it when the task provides no local Studio context. When local Studio files exist, edit them and use the CLI only on explicit request — never use this tool as a fallback. Deploys an MCP-managed schema for a workspace. Writes to MCP-managed workspaces and adopts legacy `system.schema` workspaces into MCP management on first call. Refuses Studio-deployed workspaces. Can add new types or overwrite existing types iteratively. When called on a legacy workspace, the existing types become the baseline; pass an empty `schemaDeclaration` to adopt the legacy types as-is, or pass new types to add them on top. `preview` configuration is not currently supported. Requests containing `preview` fail before deployment; use a local Studio project when custom document previews are required. If a Studio-deployed schema already exists at the target workspaceName, this tool refuses. Either update the Studio source and deploy via CLI, or choose a different `workspaceName` for a new MCP-managed schema. The separation goes both ways for writes: once a workspace is MCP-managed, schemas deployed to the same workspaceName via `npx sanity@latest schema deploy` are not selected by the default MCP resolver. Use `list_workspace_schemas` and exact `schemaId` reads to inspect both records before changing source.
Deploy studio
SANITY_MCP_DEPLOY_STUDIODeploy a managed Sanity Studio bound to an MCP-managed schema. Creates a hosted Studio whose URL follows the current environment — `sanity.studio` on production, `studio.sanity.work` on staging — and returns the concrete `studioUrl` in the response. Requires an existing MCP-managed schema at the same `(projectId, dataset, workspaceName)` address — call `deploy_schema` first if none exists. Re-run after subsequent `deploy_schema` calls so the deployed Studio picks up the latest schema.
Generate image
SANITY_MCP_GENERATE_IMAGEGenerate a new image in a document using AI. When targeting a published document, this creates or updates a draft with the generated image (published document remains unchanged). The draft must be published separately to make changes live. For image arrays, automatically adds a new array item. Note: Image generation is asynchronous and completes in the background.
Media library patch documents
SANITY_MCP_MEDIA_LIBRARY_PATCH_DOCUMENTSEdit Media Library documents. Edits are limited to the safe subset: an asset's `title` and `aspects.*`, its `cdnAccessPolicy`, and collection metadata/membership. Asset `title`/`aspects.*` edits are saved to a draft — publish them with `media_library_publish_documents`. `cdnAccessPolicy` is published-only and takes effect immediately: address it by the published id (a `drafts.` id is refused, since it cannot be staged) and patch it separately from title/aspects. Collections are edited directly. Folder placement, the version graph, and other system fields are rejected and must be managed in the Media Library app; custom metadata belongs in aspects. Every value an edit writes must be valid against the library's schema afterwards, on a draft or a published document alike; the edit is refused with the reasons otherwise. Problems the document already had elsewhere are reported as warnings, not enforced, and will stop publish until fixed. Array items without a `_key` are keyed by Content Lake on write, so re-read before addressing them by key.
Media library publish documents
SANITY_MCP_MEDIA_LIBRARY_PUBLISH_DOCUMENTSPublish asset drafts to make unpublished metadata edits (`title`, `aspects.*`) live, preserving published-only and system-managed fields. The draft is validated against the current aspect definitions first, as the Media Library app does: any error in `title` or `aspects` refuses the publish, an aspect whose definition has since been deleted is kept as it stands, and root fields outside the schema are preserved and listed. Only assets have a draft/publish flow. Fails for an asset that has no draft.
Media library upload from file
SANITY_MCP_MEDIA_LIBRARY_UPLOAD_FROM_FILEPrepare a one-use URL to upload a local or private image, video, or file up to 50 MiB to a Media Library, or add a version to an existing asset. Requires access to the file bytes and the ability to make an HTTP POST. Follow the returned upload instructions.
Media library upload from url
SANITY_MCP_MEDIA_LIBRARY_UPLOAD_FROM_URLStart an image, video, or file upload from a public HTTPS URL to a Media Library. Optionally add a version to an existing asset. Returns an operationId immediately; use assets_upload_status to retrieve the asset, assetInstance, and uploadSession. Submit uploads individually and check their operation IDs together with assets_upload_status. Honor HTTP Retry-After when rate limited. If a request is interrupted before an operationId is returned, check the destination before repeating the upload. Source size and fetch time limits apply; processing may take several minutes. If a duplicate conflict returns error.existingAssetId, follow the error message to inspect the existing asset before retrying. For a local or private file, use `media_library_upload_from_file`.
Patch documents
SANITY_MCP_PATCH_DOCUMENTSUpdate existing documents with @sanity/client patch() operations. Set documents to an object keyed by document ID, such as {"article-1":{"patches":[{"set":{"title":"New title"}}]}}. Each document’s patches are applied as one transaction. Send at most 25 documents per call; split larger updates into more calls. Edits are saved to the draft or release version, never directly to published content. For release edits, create the version first, then patch its versions.{releaseId}.* ID with the same releaseId. Do not patch the published ID before creating the release version.
Publish documents
SANITY_MCP_PUBLISH_DOCUMENTSPublish one or more drafts. Set ids to an array such as [{"id":"article-1"}]. Use the exact IDs returned by create_documents, query_documents, or get_document.
Transform image
SANITY_MCP_TRANSFORM_IMAGETransform an existing image in a document using AI. When targeting a published document, this creates or updates a draft with the transformed image (published document remains unchanged). The draft must be published separately to make changes live. Note: Image transformation is asynchronous and completes in the background.
Unpublish documents
SANITY_MCP_UNPUBLISH_DOCUMENTSUnpublish one or more published documents (moves them back to drafts), or provide releaseId to mark them for unpublishing when that release runs. Cannot immediately unpublish documents that are referenced by other documents.
Update dataset
SANITY_MCP_UPDATE_DATASETUpdate an existing dataset's visibility (public or private) and description. Public datasets allow unauthenticated reads. Pass null to clear the description. The dataset name identifies the target and cannot be changed by this tool.