log-inspector-mcp
v0.4.4MCP 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.
| Parameter | Type | Description |
|---|---|---|
filename * | string | Name of the log file to read |
max_tokens | integer | Maximum 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.
| Parameter | Type | Description |
|---|---|---|
filename * | string | Name of the log file to read |
expected_mtime | number | Expected modification time timestamp (from previous call). If file was modified, returns a warning. |
expected_size | integer | Expected file size in bytes (from previous call). If file size changed, returns a warning. |
max_tokens | integer | Maximum tokens to return (default: 4000, max: 100000). Uses ~4 chars per token estimation. |
num_lines | integer | DEPRECATED: Use max_tokens instead. Maximum number of lines (max: 1000). If specified, overrides max_tokens. |
start_line | integer | Starting 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.
| Parameter | Type | Description |
|---|---|---|
filename * | string | Name of the log file to search |
pattern * | string | Regex pattern to search for |
case_sensitive | boolean | Whether the search should be case-sensitive (default: false) |
context_after | integer | Number of lines to show after each match (max: 10). Overrides context_lines for after-context. |
context_before | integer | Number of lines to show before each match (max: 10). Overrides context_lines for before-context. |
context_lines | integer | Number of lines to show before and after each match (default: 2, max: 10). Overridden by context_before/context_after if specified. |
max_matches | integer | DEPRECATED: Use max_tokens instead. Maximum number of matches to return (max: 500). If specified, overrides max_tokens. |
max_tokens | integer | Maximum tokens to return (default: 4000, max: 100000). Uses ~4 chars per token estimation. When specified, overrides max_matches. |
skip_matches | integer | Number 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.
| Parameter | Type | Description |
|---|---|---|
filename * | string | Name of the log file to read |
lines | integer | Number of lines to read from the beginning. If not specified, uses token-based limit. |
max_tokens | integer | Maximum 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.
| Parameter | Type | Description |
|---|---|---|
filename * | string | Name of the log file to read |
lines | integer | Number of lines to read from the end. If not specified, uses token-based limit. |
max_tokens | integer | Maximum 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.
| Parameter | Type | Description |
|---|---|---|
filename * | string | Name of the log file to read |
end_line | integer | Ending line number (1-based, inclusive). If not specified, reads to end of file or token limit. |
max_tokens | integer | Maximum tokens to return (default: 4000, max: 100000). Uses ~4 chars per token estimation. |
start_line | integer | Starting 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.
| Parameter | Type | Description |
|---|---|---|
filename * | string | Name of the log file to search |
context_lines | integer | Number of lines to show before and after each error (default: 2, max: 10) |
include_warnings | boolean | Also include warning-level messages (default: false) |
max_tokens | integer | Maximum tokens to return (default: 4000, max: 100000). Uses ~4 chars per token estimation. |