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

XC-MCP: XCode CLI wrapper

by conorluddy

Add Media to Simulator

simctl-addmedia

Add photos and videos to an iOS simulator's photo library so you can test image pickers, photo library access, and media playback with real files.

Instructions

simctl-addmedia

Add media files (photos and videos) to a simulator's photo library for testing.

What it does

Adds image or video files to the simulator's Photos app, making them available for apps to access via PHPhotoLibrary or UIImagePickerController APIs.

Parameters

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

  • mediaPaths (string array, optional): Add multiple existing files in one invocation; all paths checked before mutation

  • mediaPath (string, required unless mediaPaths provided): Path to image or video file

Supported Formats

Images: jpg, jpeg, png, heic, gif, bmp Videos: mp4, mov, avi, mkv

Returns

JSON response with:

  • Media addition status

  • Media type and format detected

  • Guidance for viewing in Photos app and adding more media

Examples

Add image to photo library

await simctlAddmediaTool({
  udid: 'device-123',
  mediaPath: '/path/to/photo.jpg'
})

Add video to photo library

await simctlAddmediaTool({
  udid: 'device-123',
  mediaPath: '/path/to/video.mp4'
})

Common Use Cases

  1. Photo picker testing: Add test images for UIImagePickerController testing

  2. PHPhotoLibrary testing: Populate library for photo access API testing

  3. Image processing: Add images to test filters, crops, and transformations

  4. Video playback: Add videos to test AVPlayer integration

  5. Camera roll simulation: Populate library to simulate real user photo collection

Important Notes

  • File must exist: Validates file exists before attempting to add

  • Format validation: Only supported image/video formats are accepted

  • Simulator state: Works on both booted and shutdown simulators

  • Photos app: Media appears in simulator's Photos app immediately

  • Metadata: Original file metadata (EXIF, date, etc.) is preserved

Error Handling

  • File not found: Error if media file path doesn't exist

  • Unsupported format: Error if file extension is not in supported list

  • Simulator not found: Validates simulator exists in cache

  • Addition failure: Reports simctl errors if media cannot be added

Next Steps After Adding Media

  1. View in Photos app: simctl-launch <udid> com.apple.mobileslideshow

  2. Test photo picker: Launch your app and open UIImagePickerController

  3. Add more media: Repeat with different images/videos

  4. Test PHPhotoLibrary: Use PHPhotoLibrary.requestAuthorization() in your app

Testing Workflow

  1. Grant photo permissions: simctl-privacy <udid> <bundleId> grant photos

  2. Add test media: simctl-addmedia <udid> /path/to/photo.jpg

  3. Launch app: simctl-launch <udid> <bundleId>

  4. Test photo access: Verify app can read from photo library

  5. Take screenshot: simctl-io <udid> screenshot to verify UI

Tips

  • Test image formats: Add different image formats (JPEG, PNG, HEIC) to test compatibility

  • Test video formats: Add various video formats (MP4, MOV) to test playback

  • Large files: Be aware that adding large video files may take time

  • Batch addition: Add multiple files to simulate realistic photo library

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-addmedia"
  }
}

Input Schema

NameRequiredDescriptionDefault
udidYes
mediaPathNo
mediaPathsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv5.0.0
    • addedInput schema / properties / mediaPaths
      Added value: +{
      +  "items": {
      +    "type": "string"
      +  },
      +  "minItems": 1,
      +  "type": "array"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "udid",
      -  "mediaPath"
      -]New value: +[
      +  "udid"
      +]
  2. Addedv4.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already declare non-read-only, non-destructive, non-idempotent, closed-world, but the description adds substantive behavior beyond them: pre-flight file existence validation, extension whitelist, works on both booted and shutdown simulators, media appears in Photos immediately, original EXIF/date metadata preserved, all paths validated before mutation, and large videos may be slow. Error modes are enumerated explicitly.

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 front-loaded with headings and the essential 'what it does / parameters / returns' sections first. However, it is long and repetitive: 'Next Steps After Adding Media' overlaps heavily with 'Testing Workflow', 'Tips' restates format and batch-addition facts already given, and the two code examples merely restate the parameter list.

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?

For a three-parameter mutation tool with no annotations describing payload effects and no output schema, the description compensates well by describing the JSON response shape (status, detected media type/format) and validation behavior. Minor gap: it does not state what happens if both mediaPath and mediaPaths are passed together, nor whether additions are additive vs replacing.

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

Parameters5/5

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

Schema coverage is 0%, so the description carries the full burden and does: udid is sourced from simctl-list, mediaPaths is an optional batch that validates all paths before mutating, and mediaPath is clarified as required unless mediaPaths is supplied — a constraint the schema itself does not express. Supported format expectations (jpg/png/heic, mp4/mov) further sharpen the path semantics.

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 opening line states a specific verb and resource ('Add media files (photos and videos) to a simulator's photo library') plus the testing intent. It is clearly distinguishable from siblings like simctl-install or simctl-io, which do app install and screenshot/IO work rather than populating the Photos library.

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 gives rich context for when to reach for it: photo picker testing, PHPhotoLibrary testing, image processing, video playback, and camera-roll simulation, plus a five-step testing workflow. It does not explicitly say when NOT to use it or name an alternative for a closely related need, so it stops short of a 5.

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