log-inspector-mcp

v0.4.4
log-inspector-mcp Checked 12 hours ago Published 12 months ago

MCP server for inspecting log files in XDG_RUNTIME_DIR/log

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

list_log_files

Lists all log files in $XDG_RUNTIME_DIR/log. Use this FIRST when user reports errors or problems to see what logs are available for inspection.

get_log_content

Returns the content of a specific log file from $XDG_RUNTIME_DIR/log. Use this to inspect runtime logs when debugging errors or investigating problems. For large files, use read_log_paginated instead.

ParameterTypeDescription
filename *stringName of the log file to read
max_tokensintegerMaximum tokens to return (default: 4000, max: 100000). Uses ~4 chars per token estimation.

read_log_paginated

Reads a paginated portion of a log file. Useful for large log files. Uses token-based pagination to respect AI context limits. Tracks file modifications to detect changes between pagination calls.

ParameterTypeDescription
filename *stringName of the log file to read
expected_mtimenumberExpected modification time timestamp (from previous call). If file was modified, returns a warning.
expected_sizeintegerExpected file size in bytes (from previous call). If file size changed, returns a warning.
max_tokensintegerMaximum tokens to return (default: 4000, max: 100000). Uses ~4 chars per token estimation.
num_linesintegerDEPRECATED: Use max_tokens instead. Maximum number of lines (max: 1000). If specified, overrides max_tokens.
start_lineintegerStarting line number (1-based, default: 1)

search_log_file

Searches a log file using regex pattern and returns matching lines with surrounding context. Supports token-based pagination to respect AI context limits.

ParameterTypeDescription
filename *stringName of the log file to search
pattern *stringRegex pattern to search for
case_sensitivebooleanWhether the search should be case-sensitive (default: false)
context_afterintegerNumber of lines to show after each match (max: 10). Overrides context_lines for after-context.
context_beforeintegerNumber of lines to show before each match (max: 10). Overrides context_lines for before-context.
context_linesintegerNumber of lines to show before and after each match (default: 2, max: 10). Overridden by context_before/context_after if specified.
max_matchesintegerDEPRECATED: Use max_tokens instead. Maximum number of matches to return (max: 500). If specified, overrides max_tokens.
max_tokensintegerMaximum tokens to return (default: 4000, max: 100000). Uses ~4 chars per token estimation. When specified, overrides max_matches.
skip_matchesintegerNumber of matches to skip (for pagination, default: 0)

head_log

Reads the beginning of a log file (like Unix 'head' command). Uses token-based pagination to respect AI context limits.

ParameterTypeDescription
filename *stringName of the log file to read
linesintegerNumber of lines to read from the beginning. If not specified, uses token-based limit.
max_tokensintegerMaximum tokens to return (default: 4000, max: 100000). Uses ~4 chars per token estimation.

tail_log

Reads the end of a log file (like Unix 'tail' command). Uses token-based pagination to respect AI context limits. Ideal for checking recent log entries.

ParameterTypeDescription
filename *stringName of the log file to read
linesintegerNumber of lines to read from the end. If not specified, uses token-based limit.
max_tokensintegerMaximum tokens to return (default: 4000, max: 100000). Uses ~4 chars per token estimation.

read_log_range

Reads a specific range of lines from a log file. Uses token-based pagination to respect AI context limits.

ParameterTypeDescription
filename *stringName of the log file to read
end_lineintegerEnding line number (1-based, inclusive). If not specified, reads to end of file or token limit.
max_tokensintegerMaximum tokens to return (default: 4000, max: 100000). Uses ~4 chars per token estimation.
start_lineintegerStarting line number (1-based, inclusive)

find_errors

Quickly finds error lines in a log file by matching common error patterns (ERROR, Exception, FATAL, Failed, Traceback, panic, etc.). Ideal for quick diagnostics.

ParameterTypeDescription
filename *stringName of the log file to search
context_linesintegerNumber of lines to show before and after each error (default: 2, max: 10)
include_warningsbooleanAlso include warning-level messages (default: false)
max_tokensintegerMaximum tokens to return (default: 4000, max: 100000). Uses ~4 chars per token estimation.