Skip to main content
Glama

Read a theme file

wp_read_theme_file
Read-onlyIdempotent

Read the contents of a file inside an installed theme (defaults to the active theme). A theme is named by its folder as wp_list_themes lists it; a path outside the theme directories is refused. Returns file, content (the raw text), bytes, file_size and offset; files over 2 MB are read in slices (offset/length). A missing file or theme is an error; plugin and uploads files have their own readers (wp_read_plugin_file, wp_read_upload_file). Requires edit_themes; runs only with the site's write access on. Forwarded by AlphaBridge Connect to the one site this connection reaches.

Input Schema

NameRequiredDescriptionDefault
fileYesPath relative to the theme folder, e.g. "functions.php" or "parts/header.html", as wp_list_theme_files lists it; a path leaving the theme is refused.
themeNoInstalled theme, by its folder name as wp_list_themes lists it ("collection/theme" for a theme inside a collection). A theme WordPress counts as broken (for example a folder without style.css in wp-content/themes) can be named too, although wp_list_themes leaves it out. Default: the active theme.
lengthNoNumber of bytes to read, at most 2 MB per call. Default: up to 2 MB from offset when offset is above 0; otherwise the whole file, which a file over 2 MB is refused for (offset 0 needs a length to read a slice).
offsetNoByte offset to start reading from. Default 0.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / properties / file / description
      Previous value: -"Path relative to theme root, e.g. functions.php."New value: +"Path relative to the theme folder, e.g. \"functions.php\" or \"parts/header.html\", as wp_list_theme_files lists it; a path leaving the theme is refused."
    • changedInput schema / properties / length / description
      Previous value: -"Optional number of bytes to read (max 2 MB per call)."New value: +"Number of bytes to read, at most 2 MB per call. Default: up to 2 MB from offset when offset is above 0; otherwise the whole file, which a file over 2 MB is refused for (offset 0 needs a length to read a slice)."
    • changedInput schema / properties / offset / description
      Previous value: -"Optional byte offset to start reading from."New value: +"Byte offset to start reading from. Default 0."
  2. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive, and the description adds substantial extra context: a confinement rule (path outside theme directories refused), a 2 MB slice threshold with offset/length behavior, error behavior for missing file/theme, an auth requirement (edit_themes), and the AlphaBridge forwarding note. Slightly dense but genuinely additive rather than restating annotations.

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?

Front-loaded with purpose and default, then prerequisites, limits, and errors. Every sentence carries signal, though the single dense paragraph packs return fields, limits, auth, and forwarding into one block and could be split for easier scanning.

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?

No output schema exists, and the description fills that gap by enumerating the return fields and the slicing semantics. Combined with the error, auth, and confinement notes, an agent has everything needed to call it correctly.

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?

Schema coverage is 100%, so the baseline is 3, but the description adds meaning beyond the schema: what the return payload contains (file, content, bytes, file_size, offset) and how offset/length interact with the 2 MB slice rule. It complements rather than duplicates the parameter docs.

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?

Specific verb + resource (read a file inside an installed theme), states the default scope (active theme) and names the sibling tools that handle the other file kinds (wp_read_plugin_file, wp_read_upload_file). An agent can distinguish this from wp_list_theme_files and the other readers without opening any 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?

Explicitly routes to alternatives for plugin and uploads files, states the prerequisite capability (edit_themes), the constraint that it only runs with the site's write access on, and that paths outside theme directories are refused. It also clarifies the theme-naming convention by pointing at wp_list_themes.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources