Log Reader
The Log Reader tool (internal name builtin_system_logreader) inspects Magento log and report files under var/log and var/report. It can list files, tail them, grep across them, read small files, and page through a file by line range. All actions are bounded so large files are never returned in one shot.
Access control
Access to this tool is controlled by the MCP Tools -> Built in -> System -> Log Reader ACL resource. Enable or disable it in System -> Permissions -> User Roles -> [Role] -> Role Resources.
In addition to ACL-based access, file access is scoped:
- Access is hardcoded to
var/logandvar/reportonly. Path traversal outside these directories is blocked. var/reportfiles are always accessible.var/logfiles are limited to admin-configured file-name patterns — see Settings.- Per-role overrides exist — see the role permissions page.
When to use
The AI client uses this tool to investigate errors and recent activity — for example "what's in the exception log?", "tail the system log", or "find errors mentioning checkout across the logs".
Parameters
| Parameter | Description | Type | Required |
|---|---|---|---|
action | The operation to perform. One of list, tail, grep, read, range. | string | Yes |
file | Relative path or bare file name (e.g. system.log or report/<id>). Required for tail, read, range, and single-file grep. Omit for grep to search all var/log files. | string | Conditional |
dir | list action only. Which directory to list: log or report. | string | No |
lines | tail action only. Number of trailing lines to return. Default 100, max 2000. | integer | No |
query | grep action only. The search string or PCRE pattern. | string | Conditional |
regex | grep action only. Treat query as a regular expression. | boolean | No |
ignore_case | grep action only. Case-insensitive match. | boolean | No |
context | grep action only. Number of context lines around each match. Max 5. | integer | No |
max_matches | grep action only. Maximum matches to return. Default 100, max 500. | integer | No |
from_line | range action only. First line to return (1-based). | integer | Conditional |
to_line | range action only. Last line to return (1-based). | integer | Conditional |
The range action paginates: the response includes has_more and next_from_line so the AI client can continue reading the file in subsequent calls.
The read action refuses files larger than 256 KB and returns a structured error suggesting tail, grep, or range instead.
Example output
The list action returns the available files with their sizes. The tail, read, and range actions return file content bounded by the relevant limits. The grep action returns matching lines with their line numbers and any requested context.
Settings
The Log Reader settings are located at Stores -> Configuration -> Mirasvit Extensions -> MCP Tools -> Tools -> Log Reader.
To apply changes, clear the Magento cache after modifying these settings.
- Accessible var/log File Patterns: one file-name pattern per line. Use
*as a wildcard (e.g.system.log,*cron.log). When empty, everyvar/logfile is allowed. Thevar/reportdirectory is always accessible and is not affected by this list.
The shipped default patterns are:
system.log
debug.log
exception.log
*cron.log
Rotated and compressed logs (e.g. system.log.1, *.gz) are excluded unless you add patterns that match them.