Overview
Connect Sanity to Continue Mission Control to enable agents to manage content, validate schemas, execute GROQ queries, and automate your content workflows. When Sanity is enabled, Continue can explore document types, update content, handle migrations, and maintain content quality across your projects.What You Can Do with Sanity Integration
- Automatically validate content and schemas on every PR
- Execute GROQ queries to analyze and update content
- Generate documentation from your content model
- Manage content migrations between environments
- Monitor content quality and consistency
- Automate content creation and updates
Setup
1
Navigate to Integrations
Go to the Sanity Integrations.
2
Connect Sanity
“Connect” to Sanity. The integration uses OAuth authentication through the Sanity MCP.
3
Authorize Sanity Access
Select the Sanity organization and project to connect
4
Configure Workflows
After connecting, set up your first workflow. The integration supports:
- On PR open: Validate schemas and content when PRs are created
- Manual tasks: Run content operations on-demand
- Scheduled jobs: Periodic content audits and maintenance
Workflows
Update Sanity schema docs
Trigger: On PR openDescription: Skip the GROQ lookup. Agents manage your content through conversation. When a pull request modifies schema files (
schemas/**/*.{ts,js,tsx,jsx}, schemaTypes/**/*, or sanity.config.{ts,js}), this workflow automatically:
- Connects to Sanity - Fetches the complete current schema using Sanity MCP
- Analyzes Changes - Identifies new, modified, or removed document types
- Updates Documentation - Generates comprehensive documentation including:
- Complete field descriptions and validation rules
- Relationship diagrams between document types
- GROQ query examples for each type
- Usage guidance for developers and content teams
- Commits to PR Branch - Adds documentation directly to the existing PR branch
- Posts PR Comment - Provides a detailed summary of documented changes
What Gets Documented
For each document type, the agent generates:
- Field Reference: Every field with type, validation, and description
- Relationships: Visual diagram showing references between types
- Query Examples: Practical GROQ queries for common operations
- Studio Behavior: How fields appear and function in Sanity Studio
- Validation Rules: All constraints and requirements
- Usage Notes: Important gotchas and best practices
Documentation Location: By default, docs are created at
docs/content-model.md. The agent searches for existing documentation in several standard locations and preserves your structure.Example PR Comment
After updating the documentation, the agent posts a comprehensive comment like this:Use Cases
Content Validation
Automatically validate content structure and quality:Content Validator Agent
Task Example: “Check all blog posts for required fields and broken references”What the Agent Does:
- Scans documents for missing required fields
- Validates references between documents
- Checks for orphaned content
- Reports inconsistencies and suggests fixes
Schema Management
Manage and evolve your content schemas:Schema Analyzer Agent
Task Example: “Analyze the product schema and suggest optimizations for better performance”What the Agent Does:
- Reviews document type definitions
- Identifies unused or redundant fields
- Suggests schema improvements
- Validates relationships and data integrity
Content Migration
Automate content structure changes:Migration Manager Agent
Task Example: “Migrate all blog posts from the old schema to the new format”What the Agent Does:
- Reads content from old schema structure
- Transforms data to match new schema
- Validates migrated content
- Creates migration report with any issues
GROQ Query Execution
Run complex queries to analyze content:Content Analyzer Agent
Task Example: “Find all articles published in Q4 2023 with over 10,000 views”What the Agent Does:
- Executes GROQ queries against your dataset
- Analyzes results and identifies patterns
- Generates reports and visualizations
- Exports data for further analysis
Schema Documentation
Automatically maintain comprehensive schema documentation:Schema Docs Agent
Task Example: “Generate comprehensive documentation for all document types and their relationships”What the Agent Does:
- Fetches complete schema from Sanity
- Documents every field with types, validation, and descriptions
- Creates Mermaid diagrams showing document relationships
- Includes practical GROQ query examples
- Preserves manual documentation sections
- Updates statistics (total types, field counts)
- Table of contents with all document types
- Detailed field tables for each type
- Relationship diagrams
- Query examples for common operations
- Validation rules and Studio configurations
Content Localization
Manage multi-language content:Localization Agent
Task Example: “Verify all product pages have complete Spanish and French translations”What the Agent Does:
- Identifies missing translations
- Validates localized field structure
- Reports incomplete content
- Suggests content for translation
Running Sanity Agents in Mission Control
You can run Sanity-connected agents in two ways as one-off tasks or automated workflows:Troubleshooting
Authentication expired
Authentication expired
Problem: Agent shows authentication errorsSolutions:
- Re-authenticate through the integrations page (OAuth expires after 7 days)
- For CI/CD workflows, use environment variables instead
- Check that project permissions haven’t changed
- Verify the Sanity project still exists
Schema not found
Schema not found
Problem: Agent can’t locate schema definitionsSolutions:
- Verify schema files are in the correct location
- Check that the project ID is correct
- Ensure you’re connected to the right dataset
- Confirm schema files are properly exported
GROQ query errors
GROQ query errors
Problem: Queries fail or return unexpected resultsSolutions:
- Validate GROQ syntax in Sanity Vision
- Check that referenced fields exist
- Verify document types are spelled correctly
- Review query complexity and optimize if needed
Content validation failures
Content validation failures
Problem: Agent reports content doesn’t match schemaSolutions:
- Check for recent schema changes
- Verify required fields are present
- Review field type mismatches
- Run migration to update content structure
Migration issues
Migration issues
Problem: Content migration fails or produces errorsSolutions:
- Test migration on a small subset first
- Validate both old and new schemas
- Check for data type conflicts
- Review migration logs for specific errors
- Use transactions for atomic updates