get_logcat
Retrieve Android device logcat output to debug applications by filtering logs based on level, tag, or package name.
Instructions
Get logcat output.
filter_level: V (Verbose), D (Debug), I (Info), W (Warning), E (Error), F (Fatal)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lines | No | ||
| filter_tag | No | ||
| filter_level | No | V | |
| package_name | No | ||
| device_serial | No |
Implementation Reference
- src/adb_mcp_server/server.py:690-716 (handler)The get_logcat tool handler function. Decorated with @mcp.tool() which handles both registration and schema inference from type annotations. Executes adb logcat command with options for line count, tag filter, log level, and package filtering.@mcp.tool() def get_logcat( lines: int = 100, filter_tag: str | None = None, filter_level: str = "V", package_name: str | None = None, device_serial: str | None = None ) -> str: """ Get logcat output. filter_level: V (Verbose), D (Debug), I (Info), W (Warning), E (Error), F (Fatal) """ args = ["shell", "logcat", "-d", "-t", str(lines)] if filter_tag: args.extend(["-s", f"{filter_tag}:{filter_level}"]) output = run_adb(args, device_serial) # Filter by package if specified if package_name: lines_list = output.split('\n') output = '\n'.join(l for l in lines_list if package_name in l) return output