Skip to content

Read Theme and Plugin Files with AI ​

The file tool lets your AI assistant look inside the themes and plugins installed on your site. It can answer questions such as "which template renders my home page", "where is this hook added" or "why is my footer broken" by reading the code itself. It only reads: it cannot create, change or delete a file. This guide explains what it can do and which files it never opens.

In this article

Before You Start ​

The tool is wp_privileged_files_read_query, one of the privileged tools. It is switched off until you turn it on:

  1. Go to Easy MCP AI > Settings and scroll to the Advanced card.
  2. Under Disabled tools, clear the checkbox next to wp_privileged_files_read_query.
  3. Click Save changes, then refresh the tool list in your AI client.

The connection your AI client uses must belong to an administrator, or to a super admin on a multisite network. Because the tool only reads, it never waits for approval, even while Ask before destructive actions is on.

What the AI Can Do ​

The tool works on the folder WordPress keeps themes and plugins in, wp-content. Paths are written relative to that folder, such as themes/twentytwentyfive/functions.php. The AI picks one of four actions:

ActionWhat it does
OutlineShows the structure of one file with line numbers: the functions, classes and hooks in a PHP file, the rules in a stylesheet, the functions in a script, the top-level keys of a JSON file such as theme.json, or the blocks in a block template. The AI usually starts here
ReadReturns the lines of one file, numbered. Long files are read in parts, and the result tells the AI where to continue
SearchFinds text in the files of a folder, or a single file, and returns each match with its file and line number. Plain text or a regular expression, case-insensitive unless asked otherwise
ListShows the files and folders inside a folder, optionally with its subfolders

Without a path, search and list start in your active theme's folder.

For example, you can ask:

text
Which template renders my site's front page, and which hooks does my theme's functions.php register?

The assistant can outline the theme's functions.php, list the theme's templates folder, read the template it needs, and answer with the file names and line numbers it found.

Files the AI Never Reads ​

The tool only opens source and text files, such as PHP, CSS, JavaScript, JSON, HTML, Markdown and translation files. It never opens:

  • Anything outside wp-content, including WordPress core and wp-config.php.
  • Hidden files and folders, whose names start with a dot, such as .env or .git.
  • The uploads folder, where your media library lives.
  • The mu-plugins folder.
  • The Easy MCP AI plugin's own folder.
  • The folders that backup and caching plugins use for database dumps and settings.
  • Any file whose name starts with wp-config, including backup copies.
  • Logs, database dumps, archives, keys and certificates, whatever folder they are in.
  • Files reached through a shortcut (a symbolic link) that points outside wp-content. The one exception is a plugin that WordPress itself loads from a linked folder: its files are read under its plugins/ path.

vendor and node_modules folders are skipped by search and list unless the AI names them, because they mostly hold third-party code.

A file the tool will not open gets the same answer as a file that does not exist: "was not found or is not allowed". The answer does not say which rule applied.

Credentials Inside Files ​

Before a line is returned or searched, the tool hides values that look like credentials and shows [REDACTED] in their place. This covers, for example, a key or password defined with define(), password= or token= style settings, passwords inside web addresses, and Bearer tokens. Because lines are checked before they are searched, a hidden value cannot be found by searching for it. The result also says how many lines had something hidden.

⚠️ Warning: Hiding credentials is a second safeguard, not a guarantee. A secret written in a shape the tool does not recognize, or split over several lines, is returned as written. Keep secrets out of theme and plugin files, for example in wp-config.php or in environment variables.

Limits ​

  • Read opens files up to 2 MB, and Outline files up to 1 MB. Search skips larger files.
  • One line returns at most 8,192 bytes. A longer line is cut, with a marker saying so.
  • Binary files, such as images, return their size only.
  • A search stops after 20 seconds or 5,000 files and says that its result is partial. Ask the AI to narrow the folder if that happens.
  • Every call counts toward the limit of 60 privileged tool calls per minute.

Review What the AI Read ​

Every call is recorded in the Audit log with the action and the path the AI asked for, including requests that were refused. See Using the Easy MCP AI Audit Log.

Was this helpful?