Skip to main content
Glama

Read a theme file

read_theme_file
Read-only

Fetch a WordPress theme file's contents to review code before making changes, providing the exact text needed for reliable edits.

Instructions

Read the contents of one theme file. Always read before editing — write_theme_file replaces the whole file, and edit_theme_file needs exact text to match.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath relative to the theme root, e.g. "functions.php" or "template-parts/hero.php".
themeNoTheme stylesheet or draft id. Defaults to the active theme.
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.
max_charsNoTruncate very large files at this many characters.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv2.0.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / max_chars / maximum
      Added value: +9007199254740991
    • addedInput schema / properties / max_chars / minimum
      Added value: +1
  2. First observedv1.0.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so the safety profile is covered. The description adds value by warning that write_theme_file replaces the whole file and edit_theme_file needs exact text — behavioral context about sibling tools that helps the agent avoid destructive mistakes. It doesn't mention truncation behavior, but the max_chars parameter schema covers that.

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?

Two sentences with zero waste. The core action is stated first, and the usage guidance is front-loaded. Every sentence earns its place.

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

Completeness4/5

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

For a read-only tool with full schema coverage and annotations covering safety, the description is nearly complete. It explains the relationship to sibling write/edit tools, which is the main contextual gap an agent might have. It doesn't describe return format, but no output schema exists and the tool is simple enough that this is a minor gap.

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 description coverage is 100%, so the schema already documents all four parameters. The description adds no parameter-specific detail beyond what the schema provides. Baseline 3 is appropriate when the schema does the heavy lifting.

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 states a specific verb ('Read') and resource ('one theme file'), and the title confirms it. It clearly distinguishes itself from siblings like write_theme_file and edit_theme_file by framing reading as the prerequisite for those operations. An agent can tell this tool apart from its siblings without opening the schema.

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?

The description explicitly says 'Always read before editing' and explains why: write_theme_file replaces the whole file, and edit_theme_file needs exact text to match. This gives clear when-to-use guidance and implicitly names the alternatives. It could be slightly more explicit about when not to use it, but the context is strong.

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