Skip to main content
Glama
rahulkr
by rahulkr

get_crash_logs

Retrieve crash and exception logs from Android devices to identify and debug application failures during development and testing.

Instructions

Get crash/exception logs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
package_nameNo
device_serialNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'get_crash_logs' tool, decorated with @mcp.tool() for registration in the FastMCP server. It fetches the last 500 lines of logcat, filters for crash indicators like 'FATAL EXCEPTION', collects relevant log lines, and optionally filters by package_name.
    @mcp.tool()
    def get_crash_logs(package_name: str | None = None, device_serial: str | None = None) -> str:
        """Get crash/exception logs"""
        output = run_adb(["shell", "logcat", "-d", "-t", "500"], device_serial)
        
        # Look for crash indicators
        crash_keywords = ['FATAL EXCEPTION', 'AndroidRuntime', 'crash', 'Exception', 'Error']
        log_lines = output.split('\n')
        
        crash_lines = []
        in_crash = False
        
        for line in log_lines:
            if any(kw in line for kw in crash_keywords):
                in_crash = True
            if in_crash:
                crash_lines.append(line)
                if line.strip() == '' or len(crash_lines) > 50:
                    in_crash = False
        
        if package_name:
            crash_lines = [l for l in crash_lines if package_name in l or 'at ' in l]
        
        return '\n'.join(crash_lines) if crash_lines else "No crash logs found"
  • The @mcp.tool() decorator registers the get_crash_logs function as an MCP tool.
    @mcp.tool()
Behavior1/5

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

With no annotations provided, the description carries full burden but offers no behavioral details. It doesn't specify if this is a read-only operation, what permissions are needed, how logs are formatted, if there are rate limits, or what the output contains. This is inadequate for a tool that retrieves system data.

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

Conciseness5/5

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

The description is extremely concise with just three words, front-loading the core action and resource. There's no wasted text, though this brevity contributes to the lack of detail in other dimensions.

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 of crash log retrieval, no annotations, 0% schema coverage, and an output schema (which helps but isn't described), the description is incomplete. It fails to explain parameter usage, behavioral constraints, or differentiation from similar tools, making it insufficient for effective agent use.

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

Parameters1/5

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

Schema description coverage is 0%, so the schema provides no parameter details. The description adds no information about the two parameters (package_name and device_serial), such as their purpose, format, or how they filter logs. This leaves parameters completely undocumented.

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 'Get crash/exception logs' clearly states the verb ('Get') and resource ('crash/exception logs'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'get_logcat' or 'get_anr_traces' that also retrieve logs, leaving ambiguity about what specific type of logs this tool targets.

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 such as 'get_logcat' or 'get_anr_traces'. There's no mention of prerequisites, context, or exclusions, leaving the agent to guess based on tool names alone.

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