Log Reader
The Log Reader tool inspects Magento log and report files under var/log and var/report. It can list files, tail them, grep across them, read a whole file, or read a line range. Every action is bounded. It is read-only.
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.
The tool's file scope is hardcoded to var/log and var/report; path traversal outside these directories is blocked. Within that scope:
var/reportfiles are always accessible.var/logaccess is limited to the admin-configured file-name patterns from Tools Settings. Per-role overrides are configured on the role edit page.
When to use
The AI assistant uses this tool to investigate errors, for example "what's the latest error in the exception log?" or "search the logs for a payment gateway timeout".
Parameters
| Parameter | Description | Type | Required |
|---|---|---|---|
action | Action to perform: list, tail, grep, read, or range. | string | Yes |
file | Relative or bare log file name. Required for tail, read, range, and single-file grep. Omit for grep to search all var/log files. | string | Depends on action |
dir | list only. Which directory to list: log or report. | string | No |
lines | tail only. Number of trailing lines to return. Default: 100, max: 2000. | integer | No |
query | grep only. Search term — a literal string or a PCRE pattern. | string | No |
regex | grep only. Treat query as a regular expression. | boolean | No |
ignore_case | grep only. Case-insensitive matching. | boolean | No |
context | grep only. Number of context lines around each match. Max: 5. | integer | No |
max_matches | grep only. Maximum matches to return. Default: 100, max: 500. | integer | No |
from_line | range only. First line to return (1-based). | integer | No |
to_line | range only. Last line to return (1-based). | integer | No |
The range action paginates large files: the response includes has_more and next_from_line so the next page can be requested.
The read action refuses files larger than 256 KB. Use tail, grep, or range for large log files.
Settings
The accessible var/log file-name patterns are located at Stores -> Configuration -> Mirasvit Extensions -> MCP Tools -> Tools -> Log Reader. See Tools Settings for details.