Skip to main content
Glama
rahulkr
by rahulkr

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
NameRequiredDescriptionDefault
linesNo
filter_tagNo
filter_levelNoV
package_nameNo
device_serialNo

Implementation Reference

  • 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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rahulkr/r_adb_mcp_server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server