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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. It only mentions the filter_level parameter values without explaining what logcat output is, how it's retrieved, whether it's real-time or historical, or any permissions/limitations. For a tool with 5 parameters and no annotation coverage, this is insufficient behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with just two sentences. The first sentence states the purpose clearly, and the second provides parameter clarification. There's no wasted text, though it could benefit from better front-loading of key information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (5 parameters, no annotations, but has output schema), the description is incomplete. While the output schema may cover return values, the description lacks context about what logcat is, how the tool behaves, and guidance for parameter use. For a tool in a mobile testing context with many sibling alternatives, more completeness is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds minimal parameter semantics by explaining the filter_level values (V, D, I, W, E, F). However, with 0% schema description coverage and 5 total parameters, it only covers 1 of 5 parameters. The baseline is 3 since it adds some value beyond the schema but doesn't compensate for the significant coverage gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states 'Get logcat output' which clearly indicates the action (get) and resource (logcat output). However, it doesn't distinguish this tool from sibling tools like 'clear_logcat' or 'get_flutter_logs', leaving the specific scope and differentiation unclear. The purpose is understandable but lacks sibling context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'clear_logcat', 'get_flutter_logs', and 'get_crash_logs', there's no indication of when this general logcat retrieval is preferred over more specific logging tools. No context or exclusions are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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