Skip to main content
Glama
conorluddy

XC-MCP: XCode CLI wrapper

by conorluddy

Stream Simulator Logs

simctl-stream-logs
Read-onlyIdempotent

Stream iOS simulator console logs in real time, filter by app or predicate, and get severity-classified error and warning statistics for debugging.

Instructions

simctl-stream-logs

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
udidYes
captureNo
bundleIdNo
durationNo
predicateNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv4.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already indicate read-only, idempotent, and non-destructive behavior, and the description substantially enriches this with concrete runtime traits: 10MB buffer, timeout buffer of duration + 5 seconds, first-100-item log limit, deduplication signature details, and the fact that statistics count all severities regardless of filters. No contradiction with annotations exists.

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?

Although long, the description is well-structured with clear headings: parameters, severity classification, deduplication, returns, examples, predicate syntax, use cases, error handling, and duration guidelines. The core purpose is front-loaded, and each section earns its place by addressing likely agent questions.

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

Completeness5/5

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

Given there is no output schema, the description thoroughly explains return fields (logs, statistics, topErrors, topWarnings, sampleTail, guidance), error conditions, and runtime limits. An agent has enough information to invoke this tool correctly and interpret results, aside from the minor severity-schema mismatch noted above.

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 carries the full burden of explaining parameters. It does so very well for all schema-declared parameters (udid, bundleId, predicate, duration, capture), providing defaults and allowed values. However, it also documents a `severity` parameter that is absent from the input-schema, which could lead an agent to send an invalid argument.

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?

The description begins with a specific verb and resource: "Stream real-time console logs from iOS simulator," then enumerates filtering, severity classification, deduplication, and stats. This clearly differentiates it from siblings like simctl-list and simctl-get-details, which focus on device listing/inspection rather than log streaming.

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?

The description provides clear use contexts through 'Common Use Cases' and duration guidelines, which help an agent decide when to invoke this tool. It does not explicitly name alternatives or exclusions (e.g., when to use simctl-launch or idb-xctest-list instead), but the context is strong enough to avoid misuse.

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