Skip to main content
Glama

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

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()

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