UNPKG

xc-mcp

Version:

MCP server that wraps Xcode command-line tools for iOS/macOS development workflows

22 lines 4.34 kB
/** * Copy text to the clipboard of a simulator (simulated UIPasteboard) * * Examples: * - Copy text: udid: "device-123", text: "Hello World" * - Copy URL: udid: "device-123", text: "https://example.com" * - Copy JSON: udid: "device-123", text: '{"key":"value"}' * * This simulates the pasteboard in the simulator, allowing apps to access * the pasted content via UIPasteboard.general.string * * **Full documentation:** See simctl/pbcopy.md for detailed parameters and examples */ export declare function simctlPbcopyTool(args: any): Promise<{ content: { type: "text"; text: string; }[]; isError: boolean; }>; export declare const SIMCTL_PBCOPY_DOCS = "\n# simctl-pbcopy\n\nCopy text to simulator's clipboard for testing paste operations and UIPasteboard APIs.\n\n## What it does\n\nCopies text to the simulator's pasteboard (UIPasteboard.general), making it available for\napps to access via standard pasteboard APIs. Useful for testing paste functionality without\nmanual interaction.\n\n## Parameters\n\n- **udid** (string, required): Simulator UDID (from simctl-list)\n- **text** (string, required): Text to copy to clipboard\n\n## Returns\n\nJSON response with:\n- Copy operation status\n- Text length and preview\n- Guidance for accessing pasteboard in app\n\n## Examples\n\n### Copy simple text\n```typescript\nawait simctlPbcopyTool({\n udid: 'device-123',\n text: 'Hello World'\n})\n```\n\n### Copy URL\n```typescript\nawait simctlPbcopyTool({\n udid: 'device-123',\n text: 'https://example.com/path?param=value'\n})\n```\n\n### Copy JSON data\n```typescript\nawait simctlPbcopyTool({\n udid: 'device-123',\n text: JSON.stringify({ key: 'value', number: 123 })\n})\n```\n\n## Common Use Cases\n\n1. **Paste testing**: Test text field paste functionality\n2. **URL handling**: Test app URL detection from clipboard\n3. **Data import**: Test importing data via clipboard\n4. **Share functionality**: Test receiving shared text content\n5. **Clipboard monitoring**: Test apps that monitor pasteboard changes\n\n## How Apps Access the Text\n\nApps can access the clipboard text using:\n```swift\nif let text = UIPasteboard.general.string {\n // Use the pasted text\n}\n```\n\nOr for URLs:\n```swift\nif let url = UIPasteboard.general.url {\n // Handle the URL\n}\n```\n\n## Important Notes\n\n- **Immediate availability**: Text is available on pasteboard immediately\n- **Simulator-specific**: Each simulator has its own separate pasteboard\n- **String only**: Only supports string data (no images, files, or custom types)\n- **Persistent**: Clipboard content persists until overwritten or simulator resets\n\n## Error Handling\n\n- **Empty text**: Error if text string is empty\n- **Simulator not found**: Validates simulator exists in cache\n- **Write failure**: Reports if clipboard operation fails\n\n## Testing Workflow\n\n1. **Copy text**: `simctl-pbcopy <udid> \"Test text to paste\"`\n2. **Launch app**: `simctl-launch <udid> <bundleId>`\n3. **Navigate to input**: Use app to navigate to text field\n4. **Test paste**: App should detect clipboard content\n5. **Take screenshot**: `simctl-io <udid> screenshot` to verify paste\n\n## Use Cases by Category\n\n### Authentication Testing\n- Copy and paste email addresses\n- Copy and paste passwords (for test accounts only!)\n- Copy verification codes from clipboard\n\n### URL Handling\n- Copy URLs and test app deep link detection\n- Test universal link handling from clipboard\n- Verify URL parameter parsing\n\n### Data Import\n- Copy JSON/CSV data for import testing\n- Test clipboard-based data transfer\n- Verify data format validation\n\n### UX Testing\n- Test long-press paste menu appearance\n- Verify paste button states\n- Test clipboard change notifications\n\n## Clipboard Monitoring\n\nSome apps monitor clipboard changes. To test this:\n1. Launch app first\n2. Copy text to clipboard\n3. App should detect and respond to clipboard change\n4. Take screenshot to verify UI update\n\n## Limitations\n\n- **String data only**: Cannot copy images, files, or custom types\n- **No rich text**: Only plain text is supported\n- **No pasteboard metadata**: Cannot set pasteboard change count or other metadata\n- **Simulator scope**: Clipboard is not shared with host macOS clipboard\n"; //# sourceMappingURL=pbcopy.d.ts.map