Skip to main content
Glama

sanity_query

Execute GROQ queries to retrieve content from Sanity CMS. Supports parameters for dynamic filtering of documents.

Instructions

Execute a GROQ query against Sanity CMS. GROQ is a query language similar to GraphQL but designed for JSON documents. Examples: *[_type == "post"] gets all posts, *[_type == "post" && slug.current == "my-post"][0] gets a specific post.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe GROQ query to execute
paramsNoOptional parameters for the query (referenced as $paramName in query)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavioral traits. It does not state whether the query is read-only, whether it can mutate data, or any auth/rate limit context. The examples imply querying but safety profile is unclear.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with 2-3 sentences and examples, front-loading the main action. Every part is relevant, though the example could be more compact.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, so the description should clarify return structure (e.g., array of documents). It also lacks mention of potential performance implications or error conditions. Given the tool's complexity, this is incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% for both parameters. The description adds value with GROQ examples for the 'query' parameter (e.g., `*[_type == "post"]`), but for 'params' it only repeats schema info. Baseline 3 is appropriate as description enhances understanding somewhat.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it executes a GROQ query against Sanity CMS, with the verb 'Execute' and resource 'GROQ query'. Examples illustrate its use, and it distinctly differs from siblings that are more specific (e.g., sanity_search, sanity_list_documents).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions GROQ's similarity to GraphQL and provides examples, but does not explicitly guide when to use this tool over others (e.g., sanity_search for text search) or when not to use it. There is no mention of prerequisites or limitations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Purple-Horizons/sanity-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server