Skip to main content
Glama
XC-MCP: XCode CLI wrapper

XC-MCP: XCode CLI wrapper

by conorluddy

Stream Simulator Logs

simctl-stream-logs
Read-onlyIdempotent

Stream real-time console logs from an iOS simulator, filter by app or predicate, classify severity, and summarize deduplicated errors and warnings for debugging and test verification.

Instructions

simctl-stream-logs

outputPath optionally saves the complete captured log before response truncation.

Stream real-time console logs from iOS simulator with filtering, severity classification, deduplication, and statistics summary.

What it does

Streams console logs from a simulator in real-time, with support for filtering by process or custom predicates. Captures logs for a specified duration and returns:

  • Structured log entries with timestamps, process names, and per-line severity

  • Statistics summary (totalLines, errors, warnings, info, debug)

  • Top errors and warnings (deduplicated, capped at 15 each)

  • Sample tail of raw log output

Parameters

  • udid (string, required): Simulator UDID (from simctl-list)

  • bundleId (string, optional): Filter logs to specific app bundle ID

  • predicate (string, optional): Custom NSPredicate for log filtering

  • duration (number, optional): Capture duration in seconds (default: 10)

  • capture (boolean, optional): Whether to capture logs (default: true)

  • severity (string | string[], optional): Comma-separated or array of severity levels to include in the returned items. Allowed values: error, warning, info, debug. Default: all four. Statistics always count all severities regardless of this filter.

Severity Classification

Each log line is classified by case-insensitive pattern matching:

Severity

Patterns

error

\berror\b, \bfault\b, \bfailed\b, \bexception\b, \bcrash\b, ❌

warning

\bwarning\b, \bwarn\b, \bdeprecated\b, ⚠️

info

\binfo\b, \bnotice\b, ℹ️

debug

anything that does not match the above

Deduplication

Error and warning lines are deduplicated before appearing in topErrors / topWarnings. The deduplication signature is computed by stripping timestamps (YYYY-MM-DD HH:MM:SS) and process IDs ([1234]) then collapsing whitespace. Duplicate occurrences are collapsed into a single entry with a count field.

Returns

JSON response with:

  • logs: Filtered log entries (severity-filtered, first 100 items)

    • count, predicate, bundleId, duration, severityFilter, items[]

  • statistics: { totalLines, errors, warnings, info, debug }

  • topErrors: Deduplicated error lines, up to 15, each with message and count

  • topWarnings: Deduplicated warning lines, up to 15, each with message and count

  • sampleTail: Last 20 raw log lines

  • guidance: Human-readable summary strings

Examples

Stream all logs for 10 seconds

await streamLogsTool({ udid: 'device-123' })

Stream errors and warnings only for specific app

await streamLogsTool({
  udid: 'device-123',
  bundleId: 'com.example.MyApp',
  duration: 30,
  severity: 'error,warning',
})

Stream with custom predicate

await streamLogsTool({
  udid: 'device-123',
  predicate: 'eventMessage CONTAINS "Error" OR eventMessage CONTAINS "Warning"',
  duration: 20,
})

Predicate Syntax

Supports NSPredicate syntax for filtering:

  • Process filtering: process == "MyApp"

  • Content filtering: eventMessage CONTAINS "keyword"

  • Severity filtering: messageType == "Error"

  • Combined filters: process == "MyApp" AND eventMessage CONTAINS "network"

Common predicates:

  • process == "com.example.MyApp" - Filter by bundle ID

  • eventMessage CONTAINS "Error" - Show only errors

  • subsystem == "com.example.networking" - Filter by subsystem

  • messageType IN {"Error", "Fault"} - Show errors and faults

Common Use Cases

  1. App debugging: Stream logs for specific app during testing

  2. Error monitoring: Filter for errors and warnings via severity param

  3. Network debugging: Monitor network-related log messages

  4. Performance tracking: Capture logs during performance tests

  5. Integration testing: Verify expected log output during test runs

Important Notes

  • Timeout buffer: Command timeout is duration + 5 seconds for safety

  • Buffer size: 10MB buffer for log capture to prevent overflow

  • First 100 logs: Returns first 100 severity-filtered log entries to avoid token overflow

  • Statistics always complete: Counts cover all lines regardless of severity filter

  • Dedup on errors/warnings: topErrors and topWarnings collapse repeated messages

Error Handling

  • Missing udid: Error if udid is not provided

  • Simulator not found: Validates simulator exists

  • Command timeout: Times out if duration exceeds limit

  • Buffer overflow: May lose logs if output exceeds 10MB buffer

Duration Guidelines

  • Quick check: 5-10 seconds for basic log verification

  • Feature testing: 15-30 seconds for testing specific features

  • Integration tests: 30-60 seconds for full test scenarios

  • Debug sessions: 60+ seconds for deep debugging sessions

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "udid": "<udid>"
    },
    "name": "simctl-stream-logs"
  }
}

Input Schema

NameRequiredDescriptionDefault
udidYes
captureNo
bundleIdNo
durationNo
predicateNo
outputPathNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv5.0.0
    • addedInput schema / properties / duration / exclusiveMinimum
      Added value: +0
    • addedInput schema / properties / outputPath
      Added value: +{
      +  "type": "string"
      +}
  2. Addedv4.1.0

TDQS

A4.4/5.0
Behavior5/5

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

Despite annotations already covering read-only/non-destructive safety, the description adds substantial behavioral context: the duration+5s timeout buffer, 10MB buffer overflow risk, first-100-log truncation, statistics counting all severities regardless of filter, dedup signatures, and outputPath pre-truncation saving. This is exactly the kind of context annotations cannot supply.

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

Conciseness3/5

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

Well-organized with headers and front-loaded summary, but far too verbose. The truncation/limit facts are repeated across 'Returns', 'Important Notes', and the Deduplication section, and the severity table + predicate syntax + use cases make it long relative to what an agent needs to invoke it.

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

Completeness4/5

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

With no output schema, the description thoroughly covers return structure, error handling, buffer/timeout limits, and duration guidance. Completeness is only dented by the severity parameter absent from the schema and outputPath not fully described in the Parameters section.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must carry parameter meaning, and it documents udid, bundleId, predicate, duration, capture, and severity with defaults and allowed values. However, 'severity' is documented in the Parameters section but is NOT in the input schema, while outputPath appears only as a top-line note, creating a mismatch that could mislead.

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

Purpose5/5

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

States a specific verb+resource ('Stream real-time console logs from iOS simulator') immediately, then enumerates distinguishing capabilities (filtering, severity classification, deduplication, statistics). An agent can immediately tell this apart from siblings like simctl-list or idb-crash-list.

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

Usage Guidelines4/5

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

Provides a 'Common Use Cases' section and detailed duration guidelines (quick check vs feature testing vs integration tests), plus worked examples. It does not explicitly state when NOT to use it or compare against sibling tools that might also surface logs, so it stops short of full routing guidance.

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