Skip to main content
Glama

adb-logcat

Read Android device logs to debug applications, filter by package, level, or time, and retrieve log summaries for analysis.

Instructions

Read device logs. Returns summary with logId.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
linesNoDefault: 100
packageNo
tagsNo
levelNo
rawFilterNo
sinceNoe.g., '01-20 15:30:00.000'

Implementation Reference

  • The core handler function for the adb-logcat tool.
    export async function handleAdbLogcatTool(
      input: AdbLogcatInput,
      context: ServerContext
    ): Promise<Record<string, unknown>> {
      const device = await context.deviceState.ensureDevice(context.adb);
      const deviceId = device.id;
    
      const filter = buildLogcatFilter(input);
    
      const output = await context.adb.logcat(deviceId, {
        lines: input.lines,
        filter,
        since: input.since,
        package: input.package,
      });
    
      const logId = context.cache.generateId("logcat");
      context.cache.set(logId, { output, deviceId, filter }, "logcat", CACHE_TTLS.LOGCAT);
    
      const lines = output.split("\n").filter(Boolean);
      const errorCount = lines.filter((l) => l.includes(" E ")).length;
      const warnCount = lines.filter((l) => l.includes(" W ")).length;
    
      return {
        logId,
        summary: {
          lineCount: lines.length,
          errorCount,
          warnCount,
        },
        preview: lines.slice(0, 20).join("\n"),
        deviceId,
      };
    }
  • The input schema for the adb-logcat tool.
    export const adbLogcatInputSchema = z.object({
      lines: z.number().optional().default(100),
      package: z.string().optional(),
      tags: z.array(z.string()).optional(),
      level: z.enum(["verbose", "debug", "info", "warn", "error"]).optional(),
      rawFilter: z.string().optional(),
      since: z.string().optional(),
    });
  • The tool definition (registration metadata) for adb-logcat.
    export const adbLogcatToolDefinition = {
      name: "adb-logcat",
      description: "Read device logs. Returns summary with logId.",
      inputSchema: {
        type: "object",
        properties: {
          lines: { type: "number", description: "Default: 100" },
          package: { type: "string" },
          tags: { type: "array", items: { type: "string" } },
          level: { type: "string", enum: ["verbose", "debug", "info", "warn", "error"] },
          rawFilter: { type: "string" },
          since: { type: "string", description: "e.g., '01-20 15:30:00.000'" },
        },
      },
      annotations: {
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: false,
      },
    };
Behavior3/5

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

With no annotations, the description carries full burden. It discloses the return format ('summary with logId') which is valuable given no output schema exists. However, it omits critical logging behaviors: whether this streams continuously or returns a snapshot, whether it clears buffers, or log persistence details.

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?

Extremely concise at two sentences. Information is front-loaded with the core action first. However, given the 6-parameter complexity and low schema coverage, this brevity results in under-specification rather than efficient communication.

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?

Incomplete given the complexity (6 parameters, 0 required, multiple filtering options) and lack of annotations/output schema. While it mentions the return value, it fails to describe the filtering capabilities, parameter interactions, or behavioral constraints necessary for correct invocation.

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

Parameters2/5

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

Schema coverage is only 33% (lines, since have descriptions; package, tags, level, rawFilter do not). The description fails to compensate by explaining the filtering logic, parameter relationships, or the enum values for 'level'. No guidance on valid formats for 'package' or 'rawFilter'.

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

Purpose4/5

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

States specific action ('Read device logs') and return value ('summary with logId'), providing clear verb and resource. However, it does not differentiate from sibling 'adb-shell' which could also execute logcat commands.

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?

Provides no guidance on when to use this versus 'adb-shell' or other siblings, nor when to use specific filtering parameters (package vs tags vs rawFilter). No prerequisites mentioned (e.g., device connection requirements).

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/thecombatwombat/replicant-mcp'

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