• DATA
  • STATS
  • LISTS
  • HUMAN

How to query content with GROQ using your AI

Connect Sanity to your AI client once. After that, your agent can pull specific data patterns or count documents using GROQ.

Ask AI about this page

Short answer

How can I use GROQ to pull Sanity data with my AI?

Your AI uses GROQ to filter, fetch, and count specific documents within your Sanity dataset. You get precise data patterns instead of just reading raw text. This allows your agent to act like a data analyst for your content.

Where every query lands.

Data outcomes

The AI translates your natural language requests into structured data pulls.

DATA

Filtered content sets

The AI runs queries to find specific document types or patterns. You get the exact content you asked for.

STATS

Document counts

Your agent can count how many entities or nodes exist in your dataset. This is useful for quick audits.

LISTS

Typed document lists

The AI can list all documents of a specific type. This helps you see the structure of your content library.

HUMAN

Manual content edits

The AI only reads and queries data. You still need to log into Sanity to change or delete any content.

The workflow

What your AI does when a query arrives.

The AI moves from understanding your question to executing precise data operations.

  1. Identify data needs

    The AI looks at your request to decide which document types or patterns it needs to find.

    list_typed_documents
  2. Execute the query

    The AI writes and runs a GROQ query to pull the specific data you asked for.

    run_groq_query
  3. Calculate totals

    If you ask for a count, the AI calculates the number of specific nodes in your dataset.

    count_entity_nodes
  4. Summarize results

    The AI takes the raw data returned from the query and explains it to you in plain English.

    run_groq_query

Try it

Copy these to start.

Use these prompts to begin interacting with your Sanity data.

Starting points

Swap out the bracketed text for your actual Sanity document types or field names.

Sanity Connector

You're all set. Choose your MCP client and follow the setup instructions.

Connector linkhttps://edge.vinkius.com/vk_preview_kOcJmNXuW6tXc9VymiA6CmKfU4tOyRvWsv6XMmO3/mcp

Claude Desktop

Follow the steps below to connect in seconds.

  1. 1In Claude Desktop, open Settings → Connectors.
  2. 2Click “Add custom connector” and paste the connector link above as the remote MCP server URL.
  3. 3Click Add and start a new chat — Sanity capabilities are ready to use.
Configuration · claude_desktop_config.jsonCopy
{
  "mcpServers": {
    "sanity-mcp": {
      "url": "https://edge.vinkius.com/vk_preview_kOcJmNXuW6tXc9VymiA6CmKfU4tOyRvWsv6XMmO3/mcp"
    }
  }
}
Copy into chat04
  • List all [document type] documents in my Sanity dataset.

  • How many [entity type] nodes are currently in my Sanity content?

  • Find all [document type] where the [field name] is set to [value].

  • Count how many [document type] have a [field name] that is empty.

  • Claude
  • ChatGPT
  • Cursor
  • VS Code
  • Windsurf
  • Claude Code
  • JetBrains
  • Cline

Start here

Connect Sanity once, then ask.

Just follow the link to connect your Sanity project. Your credentials stay encrypted and secure. You can find the full list of capabilities on the Connector page.

Connect Sanity to your AI

FAQ

How this task behaves

  • 01

    Can the AI change my content in Sanity?

    No. The AI can only read and query data using GROQ. It cannot create, update, or delete your documents.

  • 02

    Does the AI need my Sanity API token?

    Yes, but Vinkius handles the connection securely. You don't have to manually paste tokens into your AI chat.

  • 03

    Can I run complex GROQ queries?

    Yes. Your AI can translate your natural language into complex GROQ syntax to filter and fetch specific data.

  • 04

    Can the AI delete documents?

    No. There are no tools provided to modify or delete content.

  • 05

    Can the AI see all my Sanity data?

    The AI can access any data your provided credentials allow it to query via GROQ.

  • More questions about Sanity? See everything the Sanity Connector can do

Connect Sanity to Claude, Cursor, ChatGPT & more