Skip to main content

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/report files are always accessible.
  • var/log access 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

ParameterDescriptionTypeRequired
actionAction to perform: list, tail, grep, read, or range.stringYes
fileRelative or bare log file name. Required for tail, read, range, and single-file grep. Omit for grep to search all var/log files.stringDepends on action
dirlist only. Which directory to list: log or report.stringNo
linestail only. Number of trailing lines to return. Default: 100, max: 2000.integerNo
querygrep only. Search term — a literal string or a PCRE pattern.stringNo
regexgrep only. Treat query as a regular expression.booleanNo
ignore_casegrep only. Case-insensitive matching.booleanNo
contextgrep only. Number of context lines around each match. Max: 5.integerNo
max_matchesgrep only. Maximum matches to return. Default: 100, max: 500.integerNo
from_linerange only. First line to return (1-based).integerNo
to_linerange only. Last line to return (1-based).integerNo
note

The range action paginates large files: the response includes has_more and next_from_line so the next page can be requested.

warning

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.