Skip to main content
Glama

Validate theme.json

validate_theme_json
Read-only

Lint a WordPress block theme's theme.json and style variations for version errors, duplicate slugs, invalid colors, missing font sources, deprecated keys, and WCAG contrast failures. Returns errors and warnings with JSON paths.

Instructions

Lint a block theme's theme.json and its style variations: version, duplicate palette/font-size/spacing/shadow slugs, invalid colour values, font families whose fontFace has no src, customTemplates/templateParts naming templates that do not exist, deprecated v1 keys and blocks, and WCAG contrast of the text/background pairs the styles actually use (root, link, button, headings, blocks and block style variations — resolved through the palette). Returns {valid, errors[], warnings[]} with JSON paths. Checks the active theme by default; pass theme_json to lint a draft file's text before writing it. Reading the raw file (for version and deprecated keys) needs the companion plugin; without it the merged REST data is linted.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
themeNoTheme stylesheet (directory) whose theme.json to read, e.g. a draft theme id. Defaults to the active theme. Global-styles data and variations are only available for the active theme; other themes need the companion plugin.
site_idNoWhich configured WordPress site to act on. Optional — with a single site configured it is used automatically; with several, the default site is used unless you name one. Run list_sites for valid ids.
theme_jsonNoRaw theme.json text to lint instead of reading one from the site — useful before write_theme_file. Template names are still checked against the active theme.
include_variationsNoAlso lint each style variation, including the contrast of its palette over the theme's styles.
include_user_stylesNoAlso check contrast with the site's Site Editor customisations layered on top (active theme only).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2.0.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already mark this read-only and non-destructive, but the description goes well beyond them: it names the returned object shape, lists the exact validation categories, explains the companion-plugin dependency, and reveals that without the plugin the validation operates on merged REST data rather than raw file contents. This is rich behavioral context an agent needs.

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

Conciseness5/5

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

The description is dense but every clause earns its place: scope, check list, return value, default behavior, draft-mode usage, and plugin dependency. It front-loads the core purpose and then groups related caveats coherently without filler.

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

Completeness5/5

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

With no output schema, the description compensates by stating the return shape ({valid, errors[], warnings[]} with JSON paths). It also covers input modes, defaulting rules, per-mode limitations, and thematic dependencies. Nothing essential for an agent to decide whether and how to invoke this tool is missing.

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

Parameters4/5

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

The input schema already documents all five parameters at 100% coverage, so the baseline is 3. The description adds extra meaning by clarifying that theme_json is useful 'before write_theme_file', that template names are checked against the active theme, and that raw-file reading requires the companion plugin — details that complement rather than merely repeat the schema.

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?

Opens with a specific verb and resource: 'Lint a block theme's theme.json and its style variations.' Enumerates concrete validation checks (duplicate slugs, invalid colour values, WCAG contrast, deprecated v1 keys) and states the return shape, making the tool's scope unmistakable and clearly distinct from nearby get/update/list tools.

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

Usage Guidelines5/5

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

States the default behavior ('Checks the active theme by default'), the draft-file use case ('pass theme_json to lint a draft file's text before writing it'), and a hard limitation ('Reading the raw file ... needs the companion plugin; without it the merged REST data is linted'). This gives an agent concrete conditions for calling the tool and what to expect in different modes.

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

Deploy Server

Other Tools