xcode_modify_plist
Update specific values in a plist file by specifying the file path, key, and new value. Streamline iOS/macOS project configurations directly through programmatic access to Xcode functionality.
Instructions
Modify a value in a plist file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Plist key to modify | |
| plist_path | Yes | Path to the plist file | |
| value | Yes | New value for the key |
Implementation Reference
- src/file-manager.ts:55-59 (handler)Core handler function that executes the PlistBuddy command to set a key-value pair in a plist file.async modifyPlist(plistPath: string, key: string, value: string): Promise<void> { // Use PlistBuddy to modify plist files const command = `/usr/libexec/PlistBuddy -c "Set :${key} ${value}" "${plistPath}"`; await execAsync(command); }
- src/command-executor.ts:191-194 (handler)Internal command handler that calls fileManager.modifyPlist for the 'modify_plist' command.case 'modify_plist': await this.fileManager.modifyPlist(args.plist_path, args.key, args.value); output = `Plist modified successfully: ${args.key} = ${args.value}`; break;
- src/index.ts:135-156 (handler)MCP CallToolRequestSchema handler that strips 'xcode_' prefix from tool name and dispatches to commandExecutor.executeCommand for execution.// Handle Xcode commands // Remove 'xcode_' prefix if present const commandName = name.startsWith('xcode_') ? name.slice(6) : name; const result = await this.commandExecutor.executeCommand(commandName, args); let responseText = result.output; if (result.error) { responseText += `\n\nWarnings/Errors:\n${result.error}`; } if (!result.success) { responseText = `Command failed: ${result.error}\n\nCommand executed: ${result.command}`; } return { content: [ { type: 'text', text: responseText, }, ], }; } catch (error) {
- src/command-executor.ts:286-305 (schema)Dynamically generates MCP tool schema (inputSchema, name as `xcode_${commandName}`, description) from loaded commands.json definitions.return Object.entries(this.commands).map(([name, command]) => ({ name: `xcode_${name}`, description: command.description, inputSchema: { type: 'object', properties: command.parameters ? Object.fromEntries( Object.entries(command.parameters).map(([paramName, paramDef]) => [ paramName, { type: paramDef.type, description: paramDef.description, ...(paramDef.default !== undefined && { default: paramDef.default }) } ]) ) : {}, required: command.parameters ? Object.entries(command.parameters) .filter(([_, paramDef]) => paramDef.required) .map(([paramName]) => paramName) : [] } }));
- src/index.ts:87-89 (registration)Registers the dynamically generated tool list (including xcode_modify_plist) with the MCP server for ListTools requests.this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [...tools, ...webMonitorTools], }));