Skip to main content
Glama

Read a theme file

read_theme_file
Read-only

Retrieve the current content of any WordPress theme file before editing to ensure accurate changes, since write replaces the entire file and edit requires exact text match.

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.
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, covering the safety profile. The description adds context about the consequences of the sibling tools (file replacement and exact-match requirement), which is not in the annotations and helps the agent understand the implicit workflow. This adds value beyond the structured data.

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, zero fluff. The main purpose is front-loaded, and the workflow guidance is concise yet complete. Every word contributes to the agent's understanding. Excellent structure.

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?

For a read-only file access tool with full schema coverage and strong annotations, the description covers the essential context: what it does, when to use it, and why it's necessary before editing. The absence of an output schema is acceptable because the tool returns raw file contents; no additional structure is needed. No critical information is missing.

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 all four parameters (path, theme, site_id, max_chars) are already documented in the input schema. The description itself does not add any parameter-level detail beyond what the schema provides. Since the schema is fully descriptive, a score of 3 is appropriate as the baseline.

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 the verb ('Read') and the resource ('the contents of one theme file'), and explicitly differentiates from sibling tools by naming write_theme_file and edit_theme_file. This makes the tool's purpose unambiguous and distinguishes it from alternatives without needing to inspect schemas.

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 provides explicit usage guidance: 'Always read before editing' and explains the reasoning for both write_theme_file (replaces whole file) and edit_theme_file (needs exact text to match). This tells the agent exactly when to use this tool versus its siblings, and the rationale is concrete and actionable.

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/alokemajumder/wpxmcp'

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