---
canonical_url: "https://docs.composio.dev/toolkits/sanity_mcp"
markdown_url: "https://docs.composio.dev/toolkits/sanity_mcp.md"
product: "platform"
version: null
last_updated: null
---

# Sanity MCP

Query, create, patch and publish Sanity content, manage schemas, releases, datasets, projects, CORS origins and Media Library assets through Sanity's hosted MCP server.

- **Category:** model context protocol
- **Auth:** DCR_OAUTH
- **Composio-managed OAuth available?** No
- **Tools:** 61
- **Triggers:** 0
- **Slug:** `SANITY_MCP`
- **Version:** 00000000_00

## Tools

### Add cors origin

**Slug:** `SANITY_MCP_ADD_CORS_ORIGIN`

Adds CORS origin(s) to allow client-side requests to a Sanity project

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `origin` | string | Yes | CORS origin to allow, in format protocol://hostname[:port].  Wildcards (*) are supported for subdomains (e.g., https://*.example.com). The unrestricted wildcard (*) always disables credentials.  Common values: - http://localhost:3000: Local development with Next.js, React, etc. - http://localhost:3333: Standalone Sanity Studio - https://*.lovable.app: Lovable preview and published apps - https://*.figma.site: Figma Make apps - https://*.vusercontent.net: v0 preview iframes - https://*.vercel.app: v0 published apps - https://*.local-credentialless.webcontainer-api.io: Bolt preview - https://*.bolt.host: Bolt published apps - https://your-domain.com: Your production domain |
| `projectId` | string | Yes | The Sanity project ID |
| `allowCredentials` | boolean | No | Allow authenticated requests from this origin. Required for hosting a Studio or making authenticated API requests. Defaults to true. Always false when origin is `*`. |

### Assets upload status

**Slug:** `SANITY_MCP_ASSETS_UPLOAD_STATUS`

Check one to 20 asset uploads using operationIds. Wait at least pollAfterMs between checks and group running uploads in one call. Honor HTTP Retry-After when rate limited. A status lookup error does not mean the upload failed. Results include asset IDs, URLs, and references; set includeMetadata for full metadata. Results are available for up to 24 hours. If an upload outcome is unknown, check the destination before repeating it.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `operationIds` | array | Yes | One to 20 operation IDs to check together. Poll only unfinished operations. |
| `includeMetadata` | boolean | No | Include full asset metadata. By default, return asset IDs, URLs, and document references. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `error` | string | No |  |
| `result` | object | No |  |
| `status` | string ("running" | "completed" | "failed" | "unknown") | No |  |
| `message` | string | No |  |
| `expiresAt` | string | No |  |
| `operations` | array | No |  |
| `operationId` | string | No |  |
| `pollAfterMs` | number | No |  |

### Cors origins delete

**Slug:** `SANITY_MCP_CORS_ORIGINS_DELETE`

Deletes a CORS origin from a Sanity project

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `origin` | string | Yes | CORS origin to delete, in format protocol://hostname[:port]. Must be an exact match. |
| `projectId` | string | Yes | The Sanity project ID |

### Cors origins list

**Slug:** `SANITY_MCP_CORS_ORIGINS_LIST`

Lists all CORS origins configured for a Sanity project

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `projectId` | string | Yes | The Sanity project ID |

### Create dataset

**Slug:** `SANITY_MCP_CREATE_DATASET`

Creates a new dataset with specified name and access settings

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `aclMode` | string ("private" | "public") | No | The ACL mode for the dataset |
| `projectId` | string | Yes | The Sanity project ID |
| `datasetName` | string | Yes | The name of the dataset |
| `description` | string | No | A brief description of the dataset purpose |

### Create documents

**Slug:** `SANITY_MCP_CREATE_DOCUMENTS`

Create one or more documents by directly providing structured content. Creates drafts (drafts.* prefix), published documents for types with liveEdit enabled, or release versions when releaseId is specified.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `documents` | array | Yes | Array of documents to create. Each document must have a type and content, with every document field inside content. Prefer Sanity-generated _id values by omitting _id from content unless a stable custom document ID is required. The entire request must fit within 100kb. Send fewer documents per call when writing large amounts of content. |
| `projectId` | string | Yes | The Sanity project ID |
| `releaseId` | string | No | Optional release ID for creating versioned documents. If provided, documents will be created under the specified release version instead of as drafts or published liveEdit documents. |
| `workspaceName` | string | No | Deprecation notice: workspaceName for schema selection is deprecated, Sanity is moving to one authoritative schema per dataset. Consolidate competing schemas and resolve conflicts explicitly before migrating. During the deprecation period, workspaceName is still supported. Omit workspaceName for the sole active or default schema, or provide it when selecting another workspace. Exact schema workspace name. Not a document type. Omit to use the sole active schema; otherwise the tool looks for "default". |

### Create project

**Slug:** `SANITY_MCP_CREATE_PROJECT`

Creates a new Sanity project and initializes it with a dataset and API tokens

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `corsOrigin` | string | No | CORS origin to allow, in format protocol://hostname[:port], or a supported app builder alias. Use * for wildcard.  `*` allows any origin and always disables credentials. Wildcards within a specific origin, such as `https://*.example.com`, can allow credentials.  Supported app builder aliases: - lovable - figma-make - v0 - bolt  If a supported app builder was provided instead of a specific origin, use that builder's alias.  Other common values: - http://localhost:3000: For embedding Studio in Next.js, React, or similar frameworks during local development - https://*.vercel.app: For v0 published apps - https://*.bolt.host: For Bolt published apps  Choose based on where your Studio or frontend will run. Additional CORS origins can be managed via the Sanity CLI using `sanity cors add`. |
| `displayName` | string | Yes | The display name for the new project |
| `organizationId` | string | Yes | Organization ID to create the project in |
| `allowCredentials` | boolean | No | Allow authenticated requests from this origin. Required for hosting a Studio. Defaults to true. Always false when corsOrigin is `*`. |

### Create release

**Slug:** `SANITY_MCP_CREATE_RELEASE`

Create a new release for grouping content changes. Optionally provide releaseId; if omitted, one is generated. Does not schedule the release: releaseType and intendedPublishAt are recorded as metadata only. Scheduling, publishing, archiving and deleting a release are not available here and must be done in Sanity Studio or via the HTTP Actions API.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `title` | string | Yes | Human-readable title for the release (e.g. "Q1 2024 Product Updates") |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |
| `releaseId` | string | No | Optional release ID, if omitted one is generated. |
| `description` | string | No | Optional description of the release |
| `releaseType` | string ("asap" | "undecided" | "scheduled") | No | Release type: "asap" to publish immediately when ready, "scheduled" for a specific date, or "undecided" (default). Recorded as intended-publish metadata only — "scheduled" does not schedule the release. |
| `intendedPublishAt` | string | No | ISO 8601 date for when the release is intended to be published. Only relevant for "scheduled" release type. Recorded as metadata only — the release is not scheduled, and list_releases will keep reporting state "active" with an empty publishAt until it is scheduled in Sanity Studio or via the HTTP Actions API. |

### Create version

**Slug:** `SANITY_MCP_CREATE_VERSION`

Create a version document (versions.{releaseId}.* prefix) for a specific release. Versions are separate from drafts and published documents, and are used for scheduled release workflows. When adding a document to a release with content changes, call create_version before patch_documents, then patch the returned version ID with the same releaseId. Do not patch the published or draft ID first because that creates an unrelated draft.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |
| `releaseId` | string | Yes | ID of the release to associate this version with |
| `documentIds` | array | Yes | Array of document IDs to create versions for (min 1, max 10) |

### Dataset assets upload from file

**Slug:** `SANITY_MCP_DATASET_ASSETS_UPLOAD_FROM_FILE`

Prepare a one-use URL for uploading an image or file up to 50 MiB to a Content Lake dataset. Works with browser-selected files, readable chat attachments, generated files, and local files. The client needs access to the bytes and HTTP POST capability; no shell or CLI is required. Prepare after the file is available. POST the raw bytes to uploadUrl before uploadExpiresAt. The HTTP response returns the document reference and an asset summary with its ID, type, URL, filename, MIME type, size, title, description, and image dimensions. Set includeMetadata to return the full asset document with all extracted metadata. If the upload response is lost, prepare a new upload URL and resend the same file bytes and upload parameters. For files in ChatGPT web, use `dataset_assets_upload_from_web_chatgpt`.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `title` | string | No |  |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `filename` | string | No | Original filename, including extension. Not inferred from the source URL. |
| `assetType` | string ("image" | "file") | Yes | Upload as a dataset image or file asset. |
| `projectId` | string | Yes | The Sanity project ID |
| `creditLine` | string | No |  |
| `description` | string | No |  |
| `includeMetadata` | boolean | No | Return the full asset document, including all extracted metadata, in the upload response. By default, the response returns a compact asset summary and the document reference. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `method` | string | Yes |  |
| `maxBytes` | number | Yes |  |
| `uploadUrl` | string | Yes |  |
| `instructions` | string | Yes |  |
| `uploadExpiresAt` | string | Yes |  |

### Dataset assets upload from url

**Slug:** `SANITY_MCP_DATASET_ASSETS_UPLOAD_FROM_URL`

Start an image or file upload from a public HTTPS URL to a Content Lake dataset. Returns an operationId immediately; use assets_upload_status to retrieve the asset and document field reference. Attach the returned reference with patch_documents, preserving existing field values. 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. For a local or private file, use `dataset_assets_upload_from_file`. For files in ChatGPT web, use `dataset_assets_upload_from_web_chatgpt`.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `url` | string | Yes | Public HTTPS asset URL. Sanity fetches it without additional authentication headers. |
| `meta` | array | No | Metadata to extract. Omit to use the API defaults. |
| `label` | string | No |  |
| `title` | string | No |  |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `source` | object | No | External source attribution. Provide its name and asset ID together. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `filename` | string | No | Original filename, including extension. Not inferred from the source URL. |
| `assetType` | string ("image" | "file") | Yes | Upload as a dataset image or file asset. |
| `projectId` | string | Yes | The Sanity project ID |
| `creditLine` | string | No |  |
| `requestKey` | string | No | Optional UUID for retrying an interrupted request. Omit to generate one automatically. Reuse a supplied UUID with identical arguments to retrieve the same upload. For changed arguments or a new attempt after failure, omit it or provide a new UUID. |
| `description` | string | No |  |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `error` | string | No |  |
| `result` | object | No |  |
| `status` | string ("running" | "completed" | "failed" | "unknown") | Yes |  |
| `message` | string | No |  |
| `expiresAt` | string | Yes |  |
| `operationId` | string | Yes |  |
| `pollAfterMs` | number | No |  |

### Dataset assets upload from web chatgpt

**Slug:** `SANITY_MCP_DATASET_ASSETS_UPLOAD_FROM_WEB_CHATGPT`

Upload a ChatGPT web attachment or generated file to a Content Lake dataset. Pass the file through ChatGPT web file input; ChatGPT web supplies a temporary download URL that Sanity fetches. Works when the ChatGPT web sandbox cannot make HTTP requests. Choose image or file as assetType. Returns an operationId; use assets_upload_status to retrieve the asset and document field reference. Attach the reference with patch_documents, preserving existing field values. If the download URL expires, pass the file again for a fresh URL and a new requestKey. Check the destination before repeating an upload whose outcome is unknown. Source size and fetch time limits apply; processing may take several minutes.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `file` | object | Yes | ChatGPT web attachment or generated file. Pass the file using ChatGPT web file input. |
| `meta` | array | No | Metadata to extract. Omit to use the API defaults. |
| `label` | string | No |  |
| `title` | string | No |  |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `source` | object | No | External source attribution. Provide its name and asset ID together. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `filename` | string | No | Original filename, including extension. Not inferred from the source URL. |
| `assetType` | string ("image" | "file") | Yes | Upload as a dataset image or file asset. |
| `projectId` | string | Yes | The Sanity project ID |
| `creditLine` | string | No |  |
| `requestKey` | string | No | Optional UUID for retrying an interrupted request. Omit to generate one automatically. Reuse a supplied UUID with identical arguments to retrieve the same upload. For changed arguments or a new attempt after failure, omit it or provide a new UUID. |
| `description` | string | No |  |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `error` | string | No |  |
| `result` | object | No |  |
| `status` | string ("running" | "completed" | "failed" | "unknown") | Yes |  |
| `message` | string | No |  |
| `expiresAt` | string | Yes |  |
| `operationId` | string | Yes |  |
| `pollAfterMs` | number | No |  |

### Deploy schema

**Slug:** `SANITY_MCP_DEPLOY_SCHEMA`

Only 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.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |
| `workspaceName` | string | No | Exact schema workspace name. Not a document type. Omit to use the sole active schema; otherwise the tool looks for "default". |
| `schemaDeclaration` | string | Yes |      Sanity schema declaration as a string of JS object literals. <syntax> - Requires literal values only: no spread operators, variables, dynamic expressions, imports, or function    bodies - If your schema makes references to other custom types in references, add those type declarations   as well, or in a separate call to this tool first - Multiple schema types can be declared in the same source string. Simply append the objects one after another - This is JavaScript object-literal syntax, not JSON: use unquoted keys and do not wrap the objects in a `[ ]` array - The schema declarations are not evaluated, so keep it declarative - `preview` configuration is not currently supported and causes the request to fail before deployment </syntax> <example>  {   name: 'author',   type: 'document',   fields: [     {       name: 'name',       type: 'string',     },   ], }  {   name: 'article',   type: 'document',   fields: [     {       name: 'title',       type: 'string',       validation: (Rule) => Rule.required().max(100),     },     {       name: 'slug',       type: 'slug'     },     {       name: 'body',       type: 'array',       of: [{type: 'block'}],     },     {       name: 'author',       type: 'reference',       to: [{type: 'author'}],     },   ], }  </example> |

### Deploy studio

**Slug:** `SANITY_MCP_DEPLOY_STUDIO`

Deploy 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.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `title` | string | Yes | Human-facing title shown in Studio navigation. |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `appHost` | string | Yes | Studio subdomain — globally unique across sanity.studio. The concrete URL is returned as `studioUrl` on success. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |
| `workspaceName` | string | No | Exact schema workspace name. Not a document type. Omit to use the sole active schema; otherwise the tool looks for "default". |

### Discard drafts

**Slug:** `SANITY_MCP_DISCARD_DRAFTS`

Discard one or more draft documents. If a document is published and has a draft, this removes the draft while leaving the published version intact. Use unpublish_documents before this tool if you want to remove a published document entirely.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `ids` | array | Yes | Document IDs to discard drafts for |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |

### Documents validate

**Slug:** `SANITY_MCP_DOCUMENTS_VALIDATE`

Validate documents against the deployed schema without modifying them. This tool is in beta. Results may be incorrect or incomplete; review them before making changes.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |
| `documentIds` | array | Yes | Exact IDs of the documents to validate, e.g. "drafts.article-1" |
| `workspaceName` | string | No | Deprecation notice: workspaceName for schema selection is deprecated, Sanity is moving to one authoritative schema per dataset. Consolidate competing schemas and resolve conflicts explicitly before migrating. During the deprecation period, workspaceName is still supported. Omit workspaceName for the sole active or default schema, or provide it when selecting another workspace. Exact schema workspace name. Not a document type. Omit to use the sole active schema; otherwise the tool looks for "default". |

### Generate image

**Slug:** `SANITY_MCP_GENERATE_IMAGE`

Generate 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.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `imagePath` | string | Yes | Path to the image field in the document (e.g., "image", "hero.image", "images"). For arrays of images, provide the array field name and a new image will be added automatically. |
| `projectId` | string | Yes | The Sanity project ID |
| `documentId` | string | Yes | The ID of the document containing the image |
| `instruction` | string | Yes | 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 (e.g., "A serene mountain landscape at dawn with misty valleys"). Keep instructions clear and specific for best results. |
| `workspaceName` | string | No | Deprecation notice: workspaceName for schema selection is deprecated, Sanity is moving to one authoritative schema per dataset. Consolidate competing schemas and resolve conflicts explicitly before migrating. During the deprecation period, workspaceName is still supported. Omit workspaceName for the sole active or default schema, or provide it when selecting another workspace. Exact schema workspace name. Not a document type. Omit to use the sole active schema; otherwise the tool looks for "default". |

### Get document

**Slug:** `SANITY_MCP_GET_DOCUMENT`

Fetch a single document by its exact ID. This is a direct ID lookup only - it does not search, filter, or query. Use when you have a specific document ID and need its full content.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |
| `documentId` | string | Yes | The exact document ID to fetch. Must be a complete, known document ID (e.g., "movie-123" or "drafts.article-456"). This is a direct ID lookup only - it does not search, filter, or query. |

### Get project studios

**Slug:** `SANITY_MCP_GET_PROJECT_STUDIOS`

Retrieves all studio applications linked to a specific Sanity project

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `projectId` | string | Yes | The Sanity project ID |

### Get sanity rules

**Slug:** `SANITY_MCP_GET_SANITY_RULES`

Load Sanity development rules. ALWAYS call list_sanity_rules first to see available rules, then load all rules relevant to your task in a single call.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `rules` | array | Yes | One or more rule names to load. Use list_sanity_rules to see available rules. |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |

### Get schema

**Slug:** `SANITY_MCP_GET_SCHEMA`

Fetch the deployed schema for a project and dataset. Deprecated workspaceName and schemaId selectors remain temporarily available for legacy multi-schema datasets.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `type` | string | No | Optional: Specific type name to fetch. If not provided, returns the full schema without detailed field definitions. Full field definitions are only available when requesting a specific type. |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `schemaId` | string | No | Deprecation notice: schemaId for schema selection is deprecated, Sanity is moving to one authoritative schema per dataset. During the deprecation period, schemaId is still supported for selecting an exact legacy schema source. Legacy exact schema source selector. Omit to use the authoritative schema for the dataset. |
| `projectId` | string | Yes | The Sanity project ID |
| `workspaceName` | string | No | Deprecation notice: workspaceName for schema selection is deprecated, Sanity is moving to one authoritative schema per dataset. Consolidate competing schemas and resolve conflicts explicitly before migrating. During the deprecation period, workspaceName is still supported. Omit workspaceName for the sole active or default schema, or provide it when selecting another workspace. Legacy schema workspace selector. Omit to use the sole deployed schema source, or default when there are multiple or none. |

### Give sanity feedback

**Slug:** `SANITY_MCP_GIVE_SANITY_FEEDBACK`

Submit feedback about Sanity when you encounter issues while working with a Sanity codebase or project.
Use this when:
- A Sanity MCP tool returned an unexpected error or confusing result
- You needed a Sanity capability that doesn't exist or is hard to use
- Sanity docs, MCP tool descriptions, or examples were unclear or incorrect
- Common Sanity surfaces such as @sanity/client, the HTTP API, schemas, Studio, or deployment were confusing or blocked progress
- You had to use a workaround for something in Sanity that should be simpler

Provide a specific, detailed message about what you were trying to do,
what happened, and what you expected instead. If the feedback concerns a
Media Library, include its `mediaLibraryId` (and `organizationId` if known).

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `message` | string | Yes | Describe the Sanity issue. Include: what you were trying to do, what you tried, and where you got stuck. Be specific — include MCP tool names, Sanity surface names such as @sanity/client, HTTP API, docs, Studio, or schemas, error messages, and parameter values when relevant. |
| `category` | string ("tool_error" | "missing_capability" | "confusing_output" | "documentation" | "sanity_api" | "other") | No | Category of feedback to help with triage |
| `severity` | string ("low" | "medium" | "high") | No | How much this blocked progress. high = completely blocked, medium = workaround needed, low = minor |
| `toolName` | string | No | The MCP tool this feedback is about, if any (e.g. "query_documents"). Leave unset for general Sanity feedback. |
| `projectId` | string | No | The Sanity project ID this feedback relates to, if any. Leave unset for general feedback not tied to a specific project. |
| `mediaLibraryId` | string | No | The Media Library ID this feedback relates to, if any — the `mediaLibraryId` you passed to a `media_library_*` tool. |
| `organizationId` | string | No | The organization ID this feedback relates to, if known. Media Libraries belong to an organization rather than a project. |

### List datasets

**Slug:** `SANITY_MCP_LIST_DATASETS`

Lists all datasets in your Sanity project

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `projectId` | string | Yes | The Sanity project ID |

### List embeddings indices

**Slug:** `SANITY_MCP_LIST_EMBEDDINGS_INDICES`

List all available embeddings indices for a dataset

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |

### List organizations

**Slug:** `SANITY_MCP_LIST_ORGANIZATIONS`

Lists all organizations the user has access to in Sanity

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |

### List projects

**Slug:** `SANITY_MCP_LIST_PROJECTS`

Lists all Sanity projects associated with your account

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |

### List releases

**Slug:** `SANITY_MCP_LIST_RELEASES`

List releases in a dataset. By default returns active and scheduled releases. Use the state filter to find published or archived releases.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | Maximum number of releases to return |
| `state` | string ("active" | "scheduled" | "published" | "archived") | No | Filter releases by state. If omitted, returns active and scheduled releases (excludes published and archived). |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `offset` | integer | No | Number of releases to skip for pagination |
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |

### List sanity rules

**Slug:** `SANITY_MCP_LIST_SANITY_RULES`

IMPORTANT: Call this FIRST before any Sanity development work. Returns available best practice rules for schemas, queries, frameworks, and visual editing. You MUST load relevant rules before writing Sanity code.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |

### List workspace schemas

**Slug:** `SANITY_MCP_LIST_WORKSPACE_SCHEMAS`

Deprecation notice: list_workspace_schemas is deprecated. Use get_schema to inspect the authoritative schema for a dataset. This tool temporarily remains available to list every deployed schema for a project and dataset, grouped by source (MCP-managed, Studio-deployed, or legacy). Duplicate workspace names and multiple Studio applications are expected; each entry includes a schemaId for exact reads with get_schema.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |

### Media assets upload from url

**Slug:** `SANITY_MCP_MEDIA_ASSETS_UPLOAD_FROM_URL`

Deprecated. Use media_library_upload_from_url with the same arguments. This tool does not start an upload.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `url` | string | Yes | Public HTTPS asset URL. Sanity fetches it without additional authentication headers. |
| `sha1` | string | No | Expected SHA-1 hash for validation. |
| `title` | string | No | Asset title. Omit to use the filename. Cannot be combined with autoGenerateTitle. |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `aspects` | string | No | Aspect values for a new asset, up to 64 KiB of JSON. Cannot be combined with assetId. |
| `assetId` | string | No | Existing Media Library asset ID to add a new version to. Cannot be combined with aspects. |
| `filename` | string | No | Original filename, including extension. Not inferred from the source URL. |
| `assetType` | string ("image" | "video" | "file") | No | Optional type override. Omit to detect the type from the source content. |
| `sessionId` | string | No |  |
| `requestKey` | string | No | Optional UUID for retrying an interrupted request. Omit to generate one automatically. Reuse a supplied UUID with identical arguments to retrieve the same upload. For changed arguments or a new attempt after failure, omit it or provide a new UUID. |
| `mediaLibraryId` | string | Yes | Target Media Library ID. |
| `cdnAccessPolicy` | string ("public" | "private") | No |  |
| `autoGenerateTitle` | boolean | No | Generate a title from image content during processing. Omit to use the filename. Cannot be combined with title, even when false. |

### Media library create documents

**Slug:** `SANITY_MCP_MEDIA_LIBRARY_CREATE_DOCUMENTS`

Create documents in a Media Library. Only `sanity.asset.collection` can be created — assets themselves come from uploading a binary, which is not supported here. Documents are created directly, not as drafts.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `documents` | array | Yes | Array of documents to create (max 25). Each document must have a type and content, with every document field inside content. |
| `mediaLibraryId` | string | Yes | The Sanity Media Library ID (org-scoped, distinct from a project/dataset). Found in the Media Library URL or organization settings, or via `media_library_list`. |

### Media library discard drafts

**Slug:** `SANITY_MCP_MEDIA_LIBRARY_DISCARD_DRAFTS`

Discard asset drafts, throwing away unpublished metadata edits and leaving the published asset intact.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `ids` | array | Yes | Asset IDs to discard unpublished metadata edits for (max 25). |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `mediaLibraryId` | string | Yes | The Sanity Media Library ID (org-scoped, distinct from a project/dataset). Found in the Media Library URL or organization settings, or via `media_library_list`. |

### Media library get document

**Slug:** `SANITY_MCP_MEDIA_LIBRARY_GET_DOCUMENT`

Fetch a single Media Library document by its exact ID. This is a direct ID lookup only - it does not search, filter, or query.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `documentId` | string | Yes | The exact document ID to fetch, e.g. an asset ID, or a `drafts.` prefixed ID for an asset with unpublished metadata edits. |
| `mediaLibraryId` | string | Yes | The Sanity Media Library ID (org-scoped, distinct from a project/dataset). Found in the Media Library URL or organization settings, or via `media_library_list`. |

### Media library get schema

**Slug:** `SANITY_MCP_MEDIA_LIBRARY_GET_SCHEMA`

Get the document types of a Media Library, or the full field definitions for one type. Call this before querying or editing: the library schema is fixed (assets, collections, folders, aspects), and the organization's own asset aspects are merged onto `sanity.asset` under `aspects`.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `type` | string | No | Optional document type to get the full schema definition for, e.g. "sanity.asset". Omit for an overview of the available types. |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `mediaLibraryId` | string | Yes | The Sanity Media Library ID (org-scoped, distinct from a project/dataset). Found in the Media Library URL or organization settings, or via `media_library_list`. |

### Media library link assets

**Slug:** `SANITY_MCP_MEDIA_LIBRARY_LINK_ASSETS`

Make one or more Media Library assets usable in project documents. For image/file assets this creates a local deliverable copy and returns a field value referencing it, plus a weak `media` global document reference back to the library; for video assets it returns a `sanity.video` value with global document references only (no local copy). Returns per-asset ready-to-use field values to apply with `patch_documents` against the target dataset. Each field type must match its asset type. Pairs with `media_library_list_asset_references`.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `links` | array | Yes | The assets to link (max 25). Each is processed independently. |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The target dataset to link the assets into. |
| `projectId` | string | Yes | The target project ID to link the assets into. |
| `mediaLibraryId` | string | Yes | The Sanity Media Library ID (org-scoped, distinct from a project/dataset). Found in the Media Library URL or organization settings, or via `media_library_list`. |

### Media library list

**Slug:** `SANITY_MCP_MEDIA_LIBRARY_LIST`

Lists the Sanity Media Libraries in an organization. Call `list_organizations` first to get an organization ID. Returns library IDs to pass as `mediaLibraryId` to the other `media_library_*` tools.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `organizationId` | string | Yes | The organization ID to list Media Libraries for (as returned by `list_organizations`). |

### Media library list asset references

**Slug:** `SANITY_MCP_MEDIA_LIBRARY_LIST_ASSET_REFERENCES`

Lists documents (across project datasets) that reference a Media Library asset. Use this before replacing an asset to see what depends on it.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `cursor` | string | No | Pagination cursor (`nextCursor`) from a previous response. |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `assetId` | string | Yes | The published asset container ID (`sanity.asset` `_id`, without a `drafts.` prefix) to find references for. References always point at the published asset. |
| `mediaLibraryId` | string | Yes | The Sanity Media Library ID (org-scoped, distinct from a project/dataset). Found in the Media Library URL or organization settings, or via `media_library_list`. |

### Media library patch documents

**Slug:** `SANITY_MCP_MEDIA_LIBRARY_PATCH_DOCUMENTS`

Edit 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.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `documents` | object | Yes | Map of document IDs to patch operations, up to 25 documents. Use the asset or collection ID; the tool decides whether the edit lands on the draft or the published document. To edit more than 25 documents, page through them with `media_library_query_documents` (order by `_id`, filter `_id > $last`, `totalAvailable` gives the count) and make one call per page; each call is independent, so a refused page leaves the others as they were. |
| `mediaLibraryId` | string | Yes | The Sanity Media Library ID (org-scoped, distinct from a project/dataset). Found in the Media Library URL or organization settings, or via `media_library_list`. |

### Media library publish documents

**Slug:** `SANITY_MCP_MEDIA_LIBRARY_PUBLISH_DOCUMENTS`

Publish 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.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `ids` | array | Yes | Asset IDs to publish metadata edits for (max 25). Draft or published IDs both work. |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `mediaLibraryId` | string | Yes | The Sanity Media Library ID (org-scoped, distinct from a project/dataset). Found in the Media Library URL or organization settings, or via `media_library_list`. |

### Media library query documents

**Slug:** `SANITY_MCP_MEDIA_LIBRARY_QUERY_DOCUMENTS`

Query a Media Library using GROQ. Assets, collections, folders, and aspect definitions are all queryable. The result count reflects the query result set, not the library total; use a `count()` query for totals.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | Maximum number of documents to return |
| `query` | string | Yes | Complete GROQ query (e.g. "*[_type == \"sanity.asset\"][0...10]{_id, title}") |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `params` | object | No | Optional parameters for the GROQ query |
| `perspective` | string ("raw" | "drafts" | "published") | No | Optional perspective to query from, as in `query_documents`: "raw" (the default) returns every document as stored, so an asset with unpublished metadata edits appears twice, as `drafts.{id}` and `{id}`; "drafts" is what the Media Library app shows, published assets with unpublished metadata edits applied, each asset once; "published" is live asset state only, what datasets and the CDN see. A Media Library has no releases. |
| `mediaLibraryId` | string | Yes | The Sanity Media Library ID (org-scoped, distinct from a project/dataset). Found in the Media Library URL or organization settings, or via `media_library_list`. |

### Media library upload from file

**Slug:** `SANITY_MCP_MEDIA_LIBRARY_UPLOAD_FROM_FILE`

Prepare 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.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `sha1` | string | No | Expected SHA-1 hash for validation. |
| `type` | string ("image" | "video" | "file") | Yes | Type of asset being uploaded. |
| `title` | string | No | Asset title. Omit to use the filename. Cannot be combined with autoGenerateTitle. |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `aspects` | string | No | Aspect values for a new asset, up to 64 KiB of JSON. Cannot be combined with assetId. |
| `assetId` | string | No | Existing Media Library asset ID to add a new version to. Cannot be combined with aspects. |
| `filename` | string | Yes | Original filename, including extension. |
| `sessionId` | string | No |  |
| `mediaLibraryId` | string | Yes | Target Media Library ID. |
| `cdnAccessPolicy` | string ("public" | "private") | No |  |
| `autoGenerateTitle` | boolean | No | Generate a title from image content during processing. Omit to use the filename. Cannot be combined with title, even when false. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `method` | string | Yes |  |
| `maxBytes` | number | Yes |  |
| `uploadUrl` | string | Yes |  |
| `instructions` | string | Yes |  |
| `uploadExpiresAt` | string | Yes |  |

### Media library upload from url

**Slug:** `SANITY_MCP_MEDIA_LIBRARY_UPLOAD_FROM_URL`

Start 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`.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `url` | string | Yes | Public HTTPS asset URL. Sanity fetches it without additional authentication headers. |
| `sha1` | string | No | Expected SHA-1 hash for validation. |
| `title` | string | No | Asset title. Omit to use the filename. Cannot be combined with autoGenerateTitle. |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `aspects` | string | No | Aspect values for a new asset, up to 64 KiB of JSON. Cannot be combined with assetId. |
| `assetId` | string | No | Existing Media Library asset ID to add a new version to. Cannot be combined with aspects. |
| `filename` | string | No | Original filename, including extension. Not inferred from the source URL. |
| `assetType` | string ("image" | "video" | "file") | No | Optional type override. Omit to detect the type from the source content. |
| `sessionId` | string | No |  |
| `requestKey` | string | No | Optional UUID for retrying an interrupted request. Omit to generate one automatically. Reuse a supplied UUID with identical arguments to retrieve the same upload. For changed arguments or a new attempt after failure, omit it or provide a new UUID. |
| `mediaLibraryId` | string | Yes | Target Media Library ID. |
| `cdnAccessPolicy` | string ("public" | "private") | No |  |
| `autoGenerateTitle` | boolean | No | Generate a title from image content during processing. Omit to use the filename. Cannot be combined with title, even when false. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `error` | string | No |  |
| `result` | object | No |  |
| `status` | string ("running" | "completed" | "failed" | "unknown") | Yes |  |
| `message` | string | No |  |
| `expiresAt` | string | Yes |  |
| `operationId` | string | Yes |  |
| `pollAfterMs` | number | No |  |

### Patch documents

**Slug:** `SANITY_MCP_PATCH_DOCUMENTS`

Update 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.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `documents` | object | Yes | Map of document IDs to patch operations, up to 25 documents. Accepts published, draft (`drafts.<id>`), and version (`versions.<releaseId>.<id>`) IDs. Published and draft IDs edit the draft unless the document type has liveEdit enabled. Version IDs edit that release version. The entire request must fit within 100kb. Send fewer documents per call when writing large amounts of content. |
| `projectId` | string | Yes | The Sanity project ID |
| `releaseId` | string | No | Optional release ID for patching documents in an existing release. |
| `workspaceName` | string | No | Deprecation notice: workspaceName for schema selection is deprecated, Sanity is moving to one authoritative schema per dataset. Consolidate competing schemas and resolve conflicts explicitly before migrating. During the deprecation period, workspaceName is still supported. Omit workspaceName for the sole active or default schema, or provide it when selecting another workspace. Exact schema workspace name. Not a document type. Omit to use the sole active schema; otherwise the tool looks for "default". |

### Publish documents

**Slug:** `SANITY_MCP_PUBLISH_DOCUMENTS`

Publish 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.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `ids` | array | Yes | Documents to publish, one entry per document: each publishes that document's current draft. |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |
| `workspaceName` | string | No | Deprecation notice: workspaceName for schema selection is deprecated, Sanity is moving to one authoritative schema per dataset. Consolidate competing schemas and resolve conflicts explicitly before migrating. During the deprecation period, workspaceName is still supported. Omit workspaceName for the sole active or default schema, or provide it when selecting another workspace. Exact schema workspace name. Not a document type. Omit to use the sole active schema; otherwise the tool looks for "default". |

### Query documents

**Slug:** `SANITY_MCP_QUERY_DOCUMENTS`

Query documents from Sanity using GROQ. Pass only the GROQ string in query. Do not include JavaScript imports, template wrappers, or defineQuery(). When using variables, set params to a JSON object such as {"type":"post"}.

Results are not truncated. A result larger than 64 KiB is rejected with an error instead. Use field projections and GROQ slices to request only what you need, and fetch large result sets in batches, for example by slicing ordered by _id and filtering with _id > $after.

For unfamiliar GROQ syntax, functions, or query patterns, fetch get_sanity_rules({rules: ["groq"]}) before proceeding.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `query` | string | Yes | Complete GROQ query. Select only needed fields and slice arrays to keep responses small. For example: *[_type == "post"] &#124; order(_id asc)[0...100]{_id, title}. For later pages, add _id > $after to the filter, passing the previous page’s last _id in params. Slice large nested arrays too. |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `params` | object | No | Optional parameters for the GROQ query as a JSON object |
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |
| `perspective` | string | No | Optional perspective to query from: "raw", "drafts", "published", or a release ID. Models should examine available releases and perspectives in the dataset before selecting one to ensure they are querying from the most appropriate view of the content. |

### Read docs

**Slug:** `SANITY_MCP_READ_DOCS`

Read a specific Sanity documentation article

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `url` | string | No | Full URL to the documentation page (e.g., "https://www.sanity.io/docs/studio/installation") |
| `path` | string | No | Path to the documentation page (e.g., "/docs/studio/installation" or "/changelog/studio-Ni41LjA") |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |

### Run sanity cli

**Slug:** `SANITY_MCP_RUN_SANITY_CLI`

Run a limited subset of Sanity CLI commands and return their output. Prefer dedicated Sanity MCP tools when possible, use CLI as a fallback for special cases. Use `--help` to list available commands or `<command> --help` for command details. Commands run without a shell and cannot access the filesystem, prompt for input, run in the background, or change authentication.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `args` | string | Yes | Arguments passed to the Sanity CLI after `sanity`, as a single string. Examples: `--help`, `datasets list --project-id <project-id>`. This tool has no project directory, so include `--project-id <project-id>` for project-scoped commands. |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |

### Schema fields patch

**Slug:** `SANITY_MCP_SCHEMA_FIELDS_PATCH`

Add, replace, or remove top-level fields on one document or object type. Read the type with schema_type_get first and pass its current schemaVersion. Each fieldDeclaration is one JavaScript object literal using deploy_schema syntax. Requires an MCP-managed or Studio-deployed schema descriptor; use deploy_schema to create an MCP-managed schema first. Legacy-only schemas must be migrated before using these tools. Upstream read failures stop the edit and must be retried after recovery. Use a dry run to preview the change before writing. If local Studio files exist, edit those files unless the user explicitly requests remote takeover. Studio takeovers require explicit user confirmation. Blueprint-managed bindings must be updated from their Blueprint source because they do not identify the legacy workspace that MCP must also mirror.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `dryRun` | boolean | No |  |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `typeName` | string | Yes |  |
| `projectId` | string | Yes | The Sanity project ID |
| `allowLossy` | boolean | No | Deprecated and ignored. Edits now preserve fields and types they do not change, so there are no conversion losses to accept. |
| `operations` | array | Yes | Upsert or delete top-level fields in the named type. |
| `confirmDeployTakeover` | boolean | No | Confirm an explicitly authorized takeover of a Studio deployment. |
| `expectedSchemaVersion` | string | Yes | Current schemaVersion returned by schema_type_get. Required to reject stale edits. |

### Schema types delete

**Slug:** `SANITY_MCP_SCHEMA_TYPES_DELETE`

Remove one or more types from the dataset schema. Read the type with schema_type_get first and pass its current schemaVersion. Types referenced by surviving types cannot be removed. Requires an MCP-managed or Studio-deployed schema descriptor; use deploy_schema to create an MCP-managed schema first. Legacy-only schemas must be migrated before using these tools. Upstream read failures stop the edit and must be retried after recovery. Use a dry run to preview the change before writing. If local Studio files exist, edit those files unless the user explicitly requests remote takeover. Studio takeovers require explicit user confirmation. Blueprint-managed bindings must be updated from their Blueprint source because they do not identify the legacy workspace that MCP must also mirror.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `dryRun` | boolean | No |  |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |
| `typeNames` | array | Yes | Names of types to remove together. |
| `allowLossy` | boolean | No | Deprecated and ignored. Edits now preserve fields and types they do not change, so there are no conversion losses to accept. |
| `confirmDeployTakeover` | boolean | No | Confirm an explicitly authorized takeover of a Studio deployment. |
| `expectedSchemaVersion` | string | Yes | Current schemaVersion returned by schema_type_get. Required to reject stale edits. |

### Schema type get

**Slug:** `SANITY_MCP_SCHEMA_TYPE_GET`

Read one type from the current MCP-managed or Studio-deployed schema before calling a granular schema edit tool. Returns the current schemaVersion required for concurrency control and a reconstructed editable definition. Legacy-only and Blueprint-managed schemas cannot be edited with these tools.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `typeName` | string | Yes | Name of the schema type to edit. |
| `projectId` | string | Yes | The Sanity project ID |

### Search docs

**Slug:** `SANITY_MCP_SEARCH_DOCS`

Search Sanity docs

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | Maximum number of results to return (default: 10, max: 50) |
| `query` | string | Yes | The search query for documentation |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |

### Semantic search

**Slug:** `SANITY_MCP_SEMANTIC_SEARCH`

Perform a semantic search on an embeddings index

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `limit` | integer | No | Maximum number of results to return |
| `query` | string | Yes | The search query to find semantically similar content |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `indexName` | string | Yes | The name of the embeddings index to search |
| `projectId` | string | Yes | The Sanity project ID |

### Transform image

**Slug:** `SANITY_MCP_TRANSFORM_IMAGE`

Transform 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.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `imagePath` | string | Yes | Path to the image field in the document (e.g., "image", "hero.image"). For image arrays, target with _key filtering: "images[_key==\"img1\"]". |
| `projectId` | string | Yes | The Sanity project ID |
| `documentId` | string | Yes | The ID of the document containing the image |
| `instruction` | string | Yes | Natural language instructions for transforming the image. Acts like a prompt telling the internal Sanity AI what to do. Describe the desired changes (e.g., "Make the background more vibrant and add warm sunset lighting"). Keep instructions clear and specific for best results. |
| `workspaceName` | string | No | Deprecation notice: workspaceName for schema selection is deprecated, Sanity is moving to one authoritative schema per dataset. Consolidate competing schemas and resolve conflicts explicitly before migrating. During the deprecation period, workspaceName is still supported. Omit workspaceName for the sole active or default schema, or provide it when selecting another workspace. Exact schema workspace name. Not a document type. Omit to use the sole active schema; otherwise the tool looks for "default". |

### Undeploy schema

**Slug:** `SANITY_MCP_UNDEPLOY_SCHEMA`

Remove a legacy MCP-managed schema from an explicitly named workspace. Inspect list_workspace_schemas first and provide an explicit workspaceName. Removes the legacy schema document and MCP ownership record. Datasets with an active Schema API binding cannot be undeployed with this tool yet. Documents and hosted Studios are preserved; a hosted Studio can still contain its own schema snapshot. If a Studio deployed outside MCP shares the workspace name, removes only the MCP ownership record and leaves that Studio schema untouched. Refuses schemas managed outside MCP and provides instructions for their source. Use schema_types_delete to remove individual types instead.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |
| `workspaceName` | string | Yes | Exact workspace name to undeploy. Use get_schema to inspect the deployed schema first. |

### Unpublish documents

**Slug:** `SANITY_MCP_UNPUBLISH_DOCUMENTS`

Unpublish 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.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `ids` | array | Yes | IDs of the documents to unpublish. Without releaseId, provide published IDs only. |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |
| `releaseId` | string | No | Optional release ID for scheduling documents to be unpublished when the release runs |

### Update dataset

**Slug:** `SANITY_MCP_UPDATE_DATASET`

Update 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.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `aclMode` | string ("private" | "public") | No | The ACL mode for the dataset |
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |
| `description` | string | No | A brief description of the dataset purpose. Pass null to clear. |

### Usage history get

**Slug:** `SANITY_MCP_USAGE_HISTORY_GET`

Get metered usage for a project, organization or media library as a series of daily, monthly or yearly data points. For the current period total, use usage_snapshot_get.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `to` | string | No | Last date of the range, such as 2026-09-30. Defaults to today. Not aligned to the period, so use the last day of a month or year for whole periods. |
| `from` | string | No | First date of the range, such as 2026-01-01. Defaults to 30 days ago. Not aligned to the period, so use the first day of a month or year for whole periods. |
| `scope` | string | No | Break usage down by this scope instead of returning resource totals. Currently the API supports "user" (per-user usage). |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `period` | string ("day" | "month" | "year") | No | Size of each data point. Defaults to month. day allows at most 90 days between from and to, month at most 24 months, year is unlimited. |
| `metrics` | array | No | Metric names to return, such as ["apirequests", "apicdnrequests", "documents", "assets"]. Omit to return every metric. Call once without this to discover the available names. |
| `cumulative` | boolean | No | Also return a running total for counter metrics. Not supported with scope. |
| `resourceId` | string | Yes | ID of the project, organization or media library. Get project and organization IDs from list_projects or list_organizations. |
| `resourceType` | string ("project" | "organization" | "media-library") | Yes | Type of resource to read usage for |
| `cumulativePeriod` | string ("day" | "month" | "year" | "forever") | No | When the running total resets to 0, locked to the calendar. Defaults to forever. Only used with cumulative. |

### Usage snapshot get

**Slug:** `SANITY_MCP_USAGE_SNAPSHOT_GET`

Get metered usage totals, such as API requests, CDN requests, documents and assets, for a project, organization or media library over one billing period. For trends over time, use usage_history_get.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `date` | string | No | Date to read the snapshot for, such as 2026-09-14. Defaults to today. |
| `scope` | string | No | Break usage down by this scope instead of returning resource totals. Currently the API supports "user" (per-user usage). |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `period` | string ("day" | "month" | "year") | No | Billing period the snapshot covers. Defaults to month. With date 2026-09-14, month covers 2026-09-01 to 2026-09-14 and year covers 2026-01-01 to 2026-09-14. |
| `metrics` | array | No | Metric names to return, such as ["apirequests", "apicdnrequests", "documents", "assets"]. Omit to return every metric. Call once without this to discover the available names. |
| `resourceId` | string | Yes | ID of the project, organization or media library. Get project and organization IDs from list_projects or list_organizations. |
| `resourceType` | string ("project" | "organization" | "media-library") | Yes | Type of resource to read usage for |
| `snapshotPeriod` | string ("startOfPeriod" | "previousPeriod") | No | startOfPeriod (default) counts from the start of the calendar period. previousPeriod counts a rolling window instead: with date 2026-09-14 and period month, it covers 2026-08-15 to 2026-09-14. |

### Version discard

**Slug:** `SANITY_MCP_VERSION_DISCARD`

Discard one or more document versions from a release

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `ids` | array | Yes | Document IDs to discard from the release |
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |
| `releaseId` | string | Yes | ID of the release to discard the document versions from |

### Whoami

**Slug:** `SANITY_MCP_WHOAMI`

Returns the currently authenticated Sanity account. Use it first for access or account troubleshooting and report the returned name, email, provider, and MCP authentication method so the user can verify which identity is active.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `intent` | string | No | 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". Make sure to not include any secrets, API keys, or information that can be considered sensitive. This helps us understand usage patterns and improve the tools. |

### Get ui context

**Slug:** `SANITY_MCP__GET_UI_CONTEXT`

Returns UI enrichment data for widgets. When documentId is provided, returns schema fields, deployed Studio URL, and resolved reference previews. When documentId is omitted, returns project-level context only (Studio URL).

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `dataset` | string | Yes | The name of the dataset in the project |
| `projectId` | string | Yes | The Sanity project ID |
| `documentId` | string | No | The document ID to fetch context for. When omitted, returns project-level context only (studio URL). |
| `maxRefDepth` | integer | No | Maximum depth for collecting reference IDs from the document (default 2) |
| `documentType` | string | No | The document _type. When provided, the tool skips fetching the document to infer its type. |
| `workspaceName` | string | No | Exact schema workspace name. Not a document type. Omit to use the sole active schema; otherwise the tool looks for "default". |
