Skip to main content

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/log and var/report only. Path traversal outside these directories is blocked.
  • var/report files are always accessible.
  • var/log files 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

ParameterDescriptionTypeRequired
actionThe operation to perform. One of list, tail, grep, read, range.stringYes
fileRelative 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.stringConditional
dirlist action only. Which directory to list: log or report.stringNo
linestail action only. Number of trailing lines to return. Default 100, max 2000.integerNo
querygrep action only. The search string or PCRE pattern.stringConditional
regexgrep action only. Treat query as a regular expression.booleanNo
ignore_casegrep action only. Case-insensitive match.booleanNo
contextgrep action only. Number of context lines around each match. Max 5.integerNo
max_matchesgrep action only. Maximum matches to return. Default 100, max 500.integerNo
from_linerange action only. First line to return (1-based).integerConditional
to_linerange action only. Last line to return (1-based).integerConditional
note

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.

note

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.

tip

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, every var/log file is allowed. The var/report directory is always accessible and is not affected by this list.

The shipped default patterns are:

system.log
debug.log
exception.log
*cron.log
note

Rotated and compressed logs (e.g. system.log.1, *.gz) are excluded unless you add patterns that match them.