salesforce-metadata-mcp 2.5.2 → 2.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -215,10 +215,11 @@ export const FlowElementSchema = z.object({
215
215
  nextElement: z.string().optional().describe("API name of the next element to connect to"),
216
216
  });
217
217
  export const CreateFlowSchema = z.object({
218
- label: z.string().min(1).max(255).describe("Human-readable flow label, e.g. 'New Lead Onboarding'"),
219
- apiName: z.string().min(1).max(80)
220
- .regex(/^[A-Za-z][A-Za-z0-9_]*$/, "Must start with a letter, no spaces")
218
+ label: z.string().optional().describe("Human-readable flow label, e.g. 'New Lead Onboarding'"),
219
+ apiName: z.string().optional()
221
220
  .describe("API name for the flow, e.g. 'New_Lead_Onboarding'"),
221
+ flowName: z.string().optional().describe("Alias for apiName"),
222
+ triggerOrder: z.number().int().optional().describe("Order for record-triggered flows"),
222
223
  description: z.string().optional().describe("Description of what this flow does"),
223
224
  flowType: z.enum(["AutoLaunchedFlow", "Flow", "RecordTriggeredFlow", "ScheduledFlow"])
224
225
  .default("AutoLaunchedFlow")
@@ -238,6 +239,7 @@ export const CreateFlowSchema = z.object({
238
239
  .describe("Advanced flow elements: Decision, GetRecords, CreateRecords, DeleteRecords, SendEmailAlert, ApexAction, Subflow, Loop, Assignment, Screen, Wait, PlatformEvent"),
239
240
  variables: z.array(FlowVariableSchema).optional().describe("Input/output variables"),
240
241
  status: z.enum(["Draft", "Active"]).default("Draft").describe("Flow status"),
242
+ runInMode: z.enum(["DefaultMode", "SystemModeWithSharing", "SystemModeWithoutSharing"]).optional().describe("Execution mode: use 'SystemModeWithoutSharing' for Agentforce-compatible flows"),
241
243
  submitForApprovalProcessName: z.string().optional().describe("API name of the Approval Process to automatically submit the record into. Works with any approval process — just pass its API name."),
242
244
  }).strict();
243
245
  // ─── Create Approval Process ──────────────────────────────────────────────────
@@ -269,9 +271,11 @@ export const CreateApprovalProcessSchema = z.object({
269
271
  .describe("API name of the process, e.g. 'Large_Deal_Approval'"),
270
272
  label: z.string().min(1).describe("Human-readable label, e.g. 'Large Deal Approval Process'"),
271
273
  description: z.string().optional().describe("Description of the approval process"),
272
- allowedSubmitters: z.array(ApprovalSubmitterSchema).min(1)
274
+ allowedSubmitters: z.array(ApprovalSubmitterSchema).optional()
273
275
  .describe("Who can submit: [{type:'owner'}] or [{type:'role', submitter:'SalesRep'}]"),
274
- approvalSteps: z.array(ApprovalStepSchema).min(1).describe("Ordered list of approval steps"),
276
+ approvalSteps: z.array(ApprovalStepSchema).optional().describe("Ordered list of approval steps"),
277
+ entryCriteria: z.string().optional().describe("Alias for entryFormula"),
278
+ approvers: z.array(z.any()).optional().describe("Simplified approvers list"),
275
279
  entryFormula: z.string().optional().describe("Formula records must satisfy to enter this process"),
276
280
  entryFilterCriteria: z.array(z.object({
277
281
  field: z.string().describe("Field API name, e.g. 'Amount'"),
@@ -302,15 +306,18 @@ export const CreateValidationRuleSchema = z.object({
302
306
  .describe("Field API name to display error next to, e.g. 'CloseDate'. Blank = top of page."),
303
307
  description: z.string().optional().describe("Description of this validation rule"),
304
308
  active: z.boolean().default(true).describe("Whether the rule is active"),
309
+ label: z.string().optional().describe("Optional label for the validation rule"),
305
310
  }).strict();
306
311
  // ─── Create Workflow Field Update ─────────────────────────────────────────────
307
312
  export const CreateWorkflowFieldUpdateSchema = z.object({
308
313
  objectName: z.string().min(1).describe("Object API name, e.g. 'Opportunity'"),
309
- actionName: z.string().min(1)
310
- .regex(/^[A-Za-z][A-Za-z0-9_]*$/, "Must start with a letter, no spaces")
314
+ actionName: z.string().optional()
311
315
  .describe("API name of the action, e.g. 'Set_Stage_Closed_Won'"),
312
- label: z.string().min(1).describe("Human-readable label"),
313
- field: z.string().min(1).describe("Field API name to update, e.g. 'StageName'"),
316
+ updateName: z.string().optional().describe("Alias for actionName"),
317
+ label: z.string().optional().describe("Human-readable label"),
318
+ field: z.string().optional().describe("Field API name to update, e.g. 'StageName'"),
319
+ fieldName: z.string().optional().describe("Alias for field"),
320
+ operation: z.string().optional().describe("Update operation type"),
314
321
  literalValue: z.string().optional().describe("Literal string/picklist value to set"),
315
322
  formula: z.string().optional().describe("Formula for the new value, e.g. 'TODAY()'"),
316
323
  nullValue: z.boolean().default(false).describe("Set the field to null/blank"),
@@ -392,18 +399,22 @@ export const CreateBusinessProcessSchema = z.object({
392
399
  objectName: z.enum(["Opportunity", "Lead", "Case", "Solution"])
393
400
  .describe("Object the business process applies to"),
394
401
  processName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Business process developer name"),
395
- label: z.string().min(1).describe("Display label"),
402
+ label: z.string().optional().describe("Display label"),
396
403
  description: z.string().optional().describe("Description"),
397
404
  isActive: z.boolean().default(true).describe("Whether this process is active"),
398
- values: z.array(z.string()).min(1).describe("Stage/status values included in this business process"),
405
+ values: z.preprocess(
406
+ (v) => Array.isArray(v) ? v.map(item => typeof item === 'object' && item !== null ? (item.fullName || item.name || item.value || String(item)) : item) : v,
407
+ z.array(z.string()).min(1)
408
+ ).describe("Stage/status values: strings or {fullName/name/value} objects"),
399
409
  }).strict();
400
410
  export const CreatePageLayoutSchema = z.object({
401
411
  objectName: z.string().min(1).describe("Object API name, e.g. 'Account' or 'Case__c'"),
402
412
  layoutName: z.string().min(1).describe("Layout developer name, e.g. 'Account_Layout'"),
403
- label: z.string().min(1).describe("Layout display label"),
413
+ label: z.string().optional().describe("Layout display label"),
404
414
  sections: z.array(z.object({
405
415
  label: z.string().describe("Section label"),
406
416
  style: z.enum(["TwoColumnsTopToBottom", "TwoColumnsLeftToRight", "OneColumn"]).default("TwoColumnsTopToBottom"),
417
+ columns: z.number().int().optional().describe("Number of columns (1 or 2)"),
407
418
  fields: z.array(z.string()).describe("Field API names in this section"),
408
419
  })).optional().describe("Layout sections with fields"),
409
420
  relatedLists: z.array(z.string()).optional().describe("Related list API names to include"),
@@ -411,33 +422,42 @@ export const CreatePageLayoutSchema = z.object({
411
422
  export const CreateSharingRuleSchema = z.object({
412
423
  objectName: z.string().min(1).describe("Object API name, e.g. 'Account', 'Opportunity'"),
413
424
  ruleName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Sharing rule developer name"),
414
- label: z.string().min(1).describe("Display label"),
415
- ruleType: z.enum(["criteria", "ownership"]).default("criteria")
416
- .describe("criteria: share based on field values. ownership: share based on record owner."),
425
+ label: z.string().optional().describe("Display label"),
426
+ ruleType: z.enum(["criteria", "ownership", "owner"]).default("criteria")
427
+ .describe("criteria: share based on field values. ownership/owner: share based on record owner."),
417
428
  accessLevel: z.enum(["Read", "Edit"]).default("Read").describe("Access level granted"),
418
- sharedTo: z.object({
419
- type: z.enum(["role", "roleAndSubordinates", "group", "queue", "allInternalUsers", "allCustomerPortalUsers"])
420
- .describe("Who to share with"),
421
- name: z.string().optional().describe("Role/group/queue API name"),
422
- }).describe("Who receives the sharing"),
429
+ sharedTo: z.union([
430
+ z.string().describe("Group/role/queue API name shorthand"),
431
+ z.object({
432
+ type: z.enum(["role", "roleAndSubordinates", "group", "queue", "allInternalUsers", "allCustomerPortalUsers"])
433
+ .describe("Who to share with"),
434
+ name: z.string().optional().describe("Role/group/queue API name"),
435
+ }),
436
+ ]).describe("Who receives the sharing"),
423
437
  criteriaItems: z.array(z.object({
424
438
  field: z.string().describe("Field API name, e.g. 'Industry'"),
425
439
  operation: z.string().describe("equals, notEqual, greaterThan, etc."),
426
440
  value: z.string().describe("Value to compare against"),
427
441
  })).optional().describe("For criteria-based rules: conditions that trigger sharing"),
428
- sharedFrom: z.object({
429
- type: z.enum(["role", "roleAndSubordinates", "group", "queue", "allInternalUsers"])
430
- .describe("For ownership rules: whose records to share"),
431
- name: z.string().optional().describe("Role/group/queue API name"),
432
- }).optional().describe("For ownership-based rules: whose records are shared"),
442
+ sharedFrom: z.union([
443
+ z.string().describe("Role/group API name shorthand"),
444
+ z.object({
445
+ type: z.enum(["role", "roleAndSubordinates", "group", "queue", "allInternalUsers"])
446
+ .describe("For ownership rules: whose records to share"),
447
+ name: z.string().optional().describe("Role/group/queue API name"),
448
+ }),
449
+ ]).optional().describe("For ownership-based rules: whose records are shared"),
433
450
  }).strict();
434
451
  export const CreateFieldDependencySchema = z.object({
435
452
  objectName: z.string().min(1).describe("Object API name"),
436
453
  controllingField: z.string().min(1).describe("Controlling picklist field API name"),
437
454
  dependentField: z.string().min(1).describe("Dependent picklist field API name"),
438
455
  valueSettings: z.array(z.object({
439
- controllingFieldValue: z.array(z.string()).describe("Controlling field values that enable this dependent value"),
440
- valueName: z.string().describe("Dependent field value to conditionally show"),
456
+ controllingFieldValue: z.union([
457
+ z.string().transform(s => [s]),
458
+ z.array(z.string()),
459
+ ]).describe("Controlling field values (string or array) that enable this dependent value"),
460
+ valueName: z.string().optional().describe("Dependent field value to conditionally show"),
441
461
  })).min(1).describe("Value dependency mappings"),
442
462
  }).strict();
443
463
  // ─── AUTOMATION ───────────────────────────────────────────────────────────────
@@ -482,7 +502,7 @@ export const RuleEntrySchema = z.object({
482
502
  export const CreateAssignmentRuleSchema = z.object({
483
503
  objectName: z.enum(["Lead", "Case"]).describe("Object to apply assignment rules to"),
484
504
  ruleName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Assignment rule developer name"),
485
- label: z.string().min(1).describe("Display label"),
505
+ label: z.string().optional().describe("Display label"),
486
506
  active: z.boolean().default(true).describe("Set as the active assignment rule"),
487
507
  ruleEntries: z.array(RuleEntrySchema).min(1).describe("Ordered list of assignment rule entries"),
488
508
  }).strict();
@@ -494,8 +514,9 @@ export const EscalationActionSchema = z.object({
494
514
  template: z.string().optional().describe("Notification email template"),
495
515
  });
496
516
  export const CreateEscalationRuleSchema = z.object({
517
+ objectName: z.string().optional().describe("Object API name (informational)"),
497
518
  ruleName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Escalation rule developer name"),
498
- label: z.string().min(1).describe("Display label"),
519
+ label: z.string().optional().describe("Display label"),
499
520
  active: z.boolean().default(true).describe("Set as the active escalation rule"),
500
521
  ruleEntries: z.array(z.object({
501
522
  entryOrder: z.number().int().min(1).describe("Processing order"),
@@ -513,7 +534,7 @@ export const CreateEscalationRuleSchema = z.object({
513
534
  export const CreateAutoResponseRuleSchema = z.object({
514
535
  objectName: z.enum(["Lead", "Case"]).describe("Object for auto-response rules"),
515
536
  ruleName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Auto-response rule developer name"),
516
- label: z.string().min(1).describe("Display label"),
537
+ label: z.string().optional().describe("Display label"),
517
538
  active: z.boolean().default(true).describe("Set as the active auto-response rule"),
518
539
  ruleEntries: z.array(z.object({
519
540
  entryOrder: z.number().int().min(1).describe("Processing order"),
@@ -554,16 +575,22 @@ export const CreateDuplicateRuleSchema = z.object({
554
575
  .describe("What to do when a duplicate is found on update"),
555
576
  alertMessage: z.string().optional().describe("Custom message shown when duplicate is detected"),
556
577
  matchingRules: z.array(z.object({
557
- matchingRule: z.string().describe("Matching rule developer name (must exist first)"),
578
+ matchingRule: z.string().optional().describe("Matching rule developer name (must exist first)"),
558
579
  matchingRuleItems: z.array(z.object({
559
580
  fieldName: z.string().describe("Source field to map"),
560
581
  matchingField: z.string().describe("Target matching field"),
561
582
  })).optional().describe("Field mappings if needed"),
562
- })).min(1).describe("Matching rules to use for duplicate detection"),
583
+ })).optional().describe("Matching rules to use for duplicate detection"),
584
+ matchingRuleName: z.string().optional().describe("Single matching rule name shorthand"),
585
+ action: z.string().optional().describe("Action: Allow, Block, AllowWithAlert"),
563
586
  }).strict();
564
587
  export const CreateApexEmailServiceSchema = z.object({
565
- functionName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Email service function name"),
566
- apexClassName: z.string().min(1).describe("Apex class that implements Messaging.InboundEmailHandler"),
588
+ functionName: z.string().optional().describe("Email service function name"),
589
+ serviceName: z.string().optional().describe("Alias for functionName"),
590
+ apexClassName: z.string().optional().describe("Apex class that implements Messaging.InboundEmailHandler"),
591
+ className: z.string().optional().describe("Alias for apexClassName"),
592
+ addresses: z.array(z.string()).optional().describe("Email addresses for this service"),
593
+ acceptAttachments: z.string().optional().describe("Attachment acceptance: None, TextOnly, BinaryOnly, All"),
567
594
  isActive: z.boolean().default(true).describe("Whether this email service is active"),
568
595
  isAuthenticationRequired: z.boolean().default(false).describe("Require sender authentication"),
569
596
  isErrorRoutingEnabled: z.boolean().default(false).describe("Route errors to an address"),
@@ -583,15 +610,18 @@ export const CreateScheduledJobSchema = z.object({
583
610
  className: z.string().min(1).describe("Apex class that implements Schedulable interface"),
584
611
  jobName: z.string().min(1).describe("Name for the scheduled job"),
585
612
  cronExpression: z.string().min(1).describe("Cron expression, e.g. '0 0 2 * * ?' for daily at 2 AM"),
613
+ description: z.string().optional().describe("Description"),
586
614
  }).strict();
587
615
  // ─── SECURITY & ACCESS ────────────────────────────────────────────────────────
588
616
  export const CreatePermissionSetSchema = z.object({
589
- fullName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Permission set API name, e.g. 'Sales_Manager_Perms'"),
617
+ fullName: z.string().optional().describe("Permission set API name, e.g. 'Sales_Manager_Perms'"),
618
+ permissionSetName: z.string().optional().describe("Alias for fullName"),
590
619
  label: z.string().min(1).describe("Display label"),
591
620
  description: z.string().optional().describe("Description of this permission set"),
592
621
  userLicense: z.string().optional().describe("User license to restrict to, e.g. 'Salesforce', 'SalesforceInspector'"),
593
622
  objectPermissions: z.array(z.object({
594
- object: z.string().describe("Object API name, e.g. 'Account', 'MyObject__c'"),
623
+ object: z.string().optional().describe("Object API name, e.g. 'Account', 'MyObject__c'"),
624
+ objectName: z.string().optional().describe("Alias for object"),
595
625
  allowCreate: z.boolean().default(false),
596
626
  allowRead: z.boolean().default(true),
597
627
  allowEdit: z.boolean().default(false),
@@ -618,8 +648,10 @@ export const CreatePermissionSetSchema = z.object({
618
648
  })).optional().describe("Tab visibility settings"),
619
649
  }).strict();
620
650
  export const CreateRoleSchema = z.object({
621
- fullName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Role API name, e.g. 'VP_Sales'"),
622
- name: z.string().min(1).describe("Role display name, e.g. 'VP of Sales'"),
651
+ fullName: z.string().optional().describe("Role API name, e.g. 'VP_Sales'"),
652
+ name: z.string().optional().describe("Role display name, e.g. 'VP of Sales'"),
653
+ roleName: z.string().optional().describe("Alias for fullName/name"),
654
+ label: z.string().optional().describe("Alias for name"),
623
655
  description: z.string().optional().describe("Description of this role"),
624
656
  parentRole: z.string().optional().describe("Parent role API name (omit for top-level role)"),
625
657
  caseAccessLevel: z.enum(["None", "Read", "Edit", "ReadWrite"]).default("ReadWrite")
@@ -633,8 +665,10 @@ export const CreateRoleSchema = z.object({
633
665
  mayForecastManagerShare: z.boolean().default(true).describe("Grant manager forecast sharing"),
634
666
  }).strict();
635
667
  export const CreateQueueSchema = z.object({
636
- fullName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Queue API name, e.g. 'Support_Level_1'"),
637
- name: z.string().min(1).describe("Queue display name"),
668
+ fullName: z.string().optional().describe("Queue API name, e.g. 'Support_Level_1'"),
669
+ name: z.string().optional().describe("Queue display name"),
670
+ queueName: z.string().optional().describe("Alias for fullName/name"),
671
+ label: z.string().optional().describe("Alias for name"),
638
672
  email: z.string().optional().describe("Queue email address for notifications"),
639
673
  doesSendEmailToMembers: z.boolean().default(false).describe("Send email to all queue members when record is added"),
640
674
  supportedObjects: z.array(z.string()).min(1).describe("Object API names this queue supports, e.g. ['Case', 'Lead']"),
@@ -645,7 +679,9 @@ export const CreateQueueSchema = z.object({
645
679
  }).optional().describe("Queue members"),
646
680
  }).strict();
647
681
  export const CreateNamedCredentialSchema = z.object({
648
- fullName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Named credential API name, e.g. 'My_External_API'"),
682
+ fullName: z.string().optional().describe("Named credential API name, e.g. 'My_External_API'"),
683
+ credentialName: z.string().optional().describe("Alias for fullName"),
684
+ authProtocol: z.string().optional().describe("Alias for protocol"),
649
685
  label: z.string().min(1).describe("Display label"),
650
686
  endpoint: z.string().url().describe("Endpoint URL, e.g. 'https://api.example.com'"),
651
687
  principalType: z.enum(["NamedUser", "Anonymous", "PerUserPrincipal"]).default("NamedUser")
@@ -659,7 +695,9 @@ export const CreateNamedCredentialSchema = z.object({
659
695
  }).strict();
660
696
  // ─── UI & EXPERIENCE ──────────────────────────────────────────────────────────
661
697
  export const CreateLightningAppSchema = z.object({
662
- fullName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("App API name, e.g. 'Sales_Console'"),
698
+ fullName: z.string().optional().describe("App API name, e.g. 'Sales_Console'"),
699
+ appName: z.string().optional().describe("Alias for fullName"),
700
+ tabs: z.array(z.any()).optional().describe("Alias for navItems"),
663
701
  label: z.string().min(1).describe("App display label"),
664
702
  description: z.string().optional().describe("Description"),
665
703
  navType: z.enum(["Standard", "Console"]).default("Standard").describe("Standard: tabs. Console: split view."),
@@ -667,12 +705,15 @@ export const CreateLightningAppSchema = z.object({
667
705
  setupExperience: z.enum(["all", "setup", "classicSetup"]).default("all"),
668
706
  isNavAutoTempTabsDisabled: z.boolean().default(false),
669
707
  isNavPersonalizationDisabled: z.boolean().default(false),
670
- navItems: z.array(z.object({
671
- name: z.string().describe("Navigation item API name, e.g. 'standard-home', 'Account', 'MyApp__c'"),
672
- type: z.enum(["Standard", "CustomTab", "InAppLearning", "VisualizationPlugin"]).default("Standard"),
673
- label: z.string().optional().describe("Override label"),
674
- defaultItem: z.boolean().default(false).describe("Set as default landing page"),
675
- })).optional().describe("Navigation bar items"),
708
+ navItems: z.array(z.union([
709
+ z.string().transform(s => ({ name: s })),
710
+ z.object({
711
+ name: z.string().describe("Navigation item API name, e.g. 'standard-home', 'Account', 'MyApp__c'"),
712
+ type: z.enum(["Standard", "CustomTab", "InAppLearning", "VisualizationPlugin"]).default("Standard"),
713
+ label: z.string().optional().describe("Override label"),
714
+ defaultItem: z.boolean().default(false).describe("Set as default landing page"),
715
+ }),
716
+ ])).optional().describe("Navigation bar items: strings or {name, type?, label?, defaultItem?} objects"),
676
717
  utilityItems: z.array(z.object({
677
718
  name: z.string().describe("Utility item API name"),
678
719
  type: z.enum(["Standard", "CustomTab"]).default("Standard"),
@@ -681,7 +722,9 @@ export const CreateLightningAppSchema = z.object({
681
722
  })).optional().describe("Utility bar items"),
682
723
  }).strict();
683
724
  export const CreateTabSchema = z.object({
684
- fullName: z.string().min(1).describe("Tab API name, typically same as the object API name, e.g. 'Invoice__c'"),
725
+ fullName: z.string().optional().describe("Tab API name, typically same as the object API name, e.g. 'Invoice__c'"),
726
+ tabName: z.string().optional().describe("Alias for fullName"),
727
+ objectApiName: z.string().optional().describe("Alias for sobjectName"),
685
728
  label: z.string().optional().describe("Tab label (defaults to object label)"),
686
729
  motif: z.string().default("Custom64: Coin").describe("Icon/motif for the tab, e.g. 'Custom64: Coin', 'Custom1: default'"),
687
730
  sobjectName: z.string().optional().describe("Object API name if this is a custom object tab"),
@@ -692,7 +735,8 @@ export const CreateTabSchema = z.object({
692
735
  }).strict();
693
736
  export const CreateCompactLayoutSchema = z.object({
694
737
  objectName: z.string().min(1).describe("Object API name to add the compact layout to"),
695
- fullName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Compact layout developer name"),
738
+ fullName: z.string().optional().describe("Compact layout developer name"),
739
+ compactLayoutName: z.string().optional().describe("Alias for fullName"),
696
740
  label: z.string().min(1).describe("Display label"),
697
741
  fields: z.array(z.string()).min(1).max(10).describe("Field API names to show (max 10), e.g. ['Name', 'Status__c', 'Amount']"),
698
742
  setAsDefault: z.boolean().default(true).describe("Set this compact layout as the default for the object"),
@@ -711,15 +755,22 @@ export const CreateListViewSchema = z.object({
711
755
  booleanFilter: z.string().optional().describe("Boolean filter expression, e.g. '1 AND 2 OR 3'"),
712
756
  filterScope: z.enum(["Everything", "Mine", "Team", "Queue", "Delegated", "MyTerritory",
713
757
  "SalesTeam", "AssignedToMe"]).default("Everything").describe("Base scope filter"),
714
- sharedTo: z.object({
715
- type: z.enum(["AllUsers", "Group", "Role", "RoleAndSubordinates"]).default("AllUsers"),
716
- name: z.string().optional(),
717
- }).optional().describe("Who can see this list view"),
758
+ sharedTo: z.union([
759
+ z.string().describe("Group/role API name shorthand"),
760
+ z.object({
761
+ type: z.enum(["AllUsers", "Group", "Role", "RoleAndSubordinates"]).default("AllUsers"),
762
+ name: z.string().optional(),
763
+ }),
764
+ ]).optional().describe("Who can see this list view"),
765
+ visibility: z.string().optional().describe("List view visibility: SharedWithEveryone, SharedWith, Private"),
718
766
  }).strict();
719
767
  export const CreateEmailTemplateSchema = z.object({
720
- fullName: z.string().min(1).describe("Full name including folder: 'FolderName/TemplateName' or 'unfiled$public/TemplateName'"),
721
- name: z.string().min(1).describe("Template developer name (no spaces)"),
722
- label: z.string().min(1).describe("Display label"),
768
+ fullName: z.string().optional().describe("Full name including folder: 'FolderName/TemplateName' or 'unfiled$public/TemplateName'"),
769
+ templateName: z.string().optional().describe("Alias for name/fullName"),
770
+ folderName: z.string().optional().describe("Folder API name"),
771
+ name: z.string().optional().describe("Template developer name (no spaces)"),
772
+ label: z.string().optional().describe("Display label"),
773
+ templateType: z.string().optional().describe("Alias for type"),
723
774
  description: z.string().optional().describe("Description"),
724
775
  subject: z.string().min(1).describe("Email subject line (can include merge fields like {!Account.Name})"),
725
776
  htmlValue: z.string().optional().describe("HTML body of the email (for html type templates)"),
@@ -732,14 +783,18 @@ export const CreateEmailTemplateSchema = z.object({
732
783
  senderName: z.string().optional().describe("Sender display name"),
733
784
  }).strict();
734
785
  export const CreateStaticResourceSchema = z.object({
735
- fullName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Static resource API name, e.g. 'MyLibrary'"),
786
+ fullName: z.string().optional().describe("Static resource API name, e.g. 'MyLibrary'"),
787
+ resourceName: z.string().optional().describe("Alias for fullName"),
736
788
  contentType: z.string().max(128).default("text/plain").describe("MIME type, e.g. 'application/json', 'text/css', 'application/javascript'"),
737
789
  content: z.string().min(1).max(5_000_000).describe("The file content as a string (text, JSON, JS, CSS, etc.)"),
738
790
  cacheControl: z.enum(["Public", "Private"]).default("Public").describe("Cache control setting"),
739
791
  description: z.string().max(1000).optional().describe("Description of this resource"),
740
792
  }).strict();
741
793
  export const CreateCustomNotificationTypeSchema = z.object({
742
- fullName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Custom notification type API name"),
794
+ fullName: z.string().optional().describe("Custom notification type API name"),
795
+ notificationTypeName: z.string().optional().describe("Alias for fullName"),
796
+ label: z.string().optional().describe("Display label"),
797
+ channels: z.any().optional().describe("Channel configuration {mobileEnabled, desktopEnabled}"),
743
798
  customNotifTypeName: z.string().min(1).describe("Display name for the notification type"),
744
799
  description: z.string().optional().describe("Description"),
745
800
  desktop: z.boolean().default(true).describe("Enable for desktop (web browser)"),
@@ -747,10 +802,12 @@ export const CreateCustomNotificationTypeSchema = z.object({
747
802
  }).strict();
748
803
  // ─── REPORTING ────────────────────────────────────────────────────────────────
749
804
  export const CreateReportTypeSchema = z.object({
750
- fullName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Report type developer name"),
805
+ fullName: z.string().optional().describe("Report type developer name"),
806
+ reportTypeName: z.string().optional().describe("Alias for fullName"),
751
807
  label: z.string().min(1).describe("Display label"),
752
808
  description: z.string().optional().describe("Description"),
753
809
  baseObject: z.string().min(1).describe("Primary object API name, e.g. 'Account', 'Opportunity'"),
810
+ columns: z.array(z.string()).optional().describe("Field API names from the base object to include (e.g. ['Name', 'Priority__c']). Name is always included."),
754
811
  category: z.enum(["accounts", "opportunities", "forecasts", "cases", "leads", "activities",
755
812
  "campaigns", "busop", "other"]).default("other").describe("Report category for organization"),
756
813
  deployed: z.boolean().default(true).describe("Deploy this report type immediately"),
@@ -764,18 +821,22 @@ export const CreateReportTypeSchema = z.object({
764
821
  })).optional().describe("Related object joins"),
765
822
  }).strict();
766
823
  export const CreateDashboardSchema = z.object({
767
- fullName: z.string().min(1).describe("Dashboard full name including folder: 'FolderName/DashboardName'"),
768
- title: z.string().min(1).describe("Dashboard title"),
824
+ fullName: z.string().optional().describe("Dashboard full name including folder: 'FolderName/DashboardName'"),
825
+ dashboardName: z.string().optional().describe("Alias for fullName"),
826
+ title: z.string().optional().describe("Dashboard title"),
827
+ label: z.string().optional().describe("Alias for title"),
828
+ folderName: z.string().optional().describe("Folder to place the dashboard in"),
769
829
  description: z.string().optional().describe("Description"),
770
830
  runningUser: z.string().optional().describe("Username to run the dashboard as"),
771
831
  components: z.array(z.object({
772
- type: z.enum(["Metric", "Gauge", "Table", "Chart", "Map", "VisualforcePage", "Scontrol"])
773
- .default("Chart").describe("Component type"),
774
- reportApiName: z.string().optional().describe("Report API name to power this component"),
832
+ componentType: z.string().optional().describe("Salesforce DashboardComponentType: Bar, BarChart, Line, LineChart, Metric, Gauge, Table, Donut, Funnel, etc."),
833
+ type: z.string().optional().describe("Alias for componentType"),
834
+ reportName: z.string().optional().describe("Report API name"),
835
+ reportApiName: z.string().optional().describe("Alias for reportName"),
775
836
  header: z.string().optional().describe("Component header text"),
837
+ title: z.string().optional().describe("Alias for header"),
776
838
  footer: z.string().optional().describe("Component footer text"),
777
- chartType: z.enum(["Bar", "BarGrouped", "BarStacked", "Line", "Pie", "Donut", "Funnel", "Scatter"]).optional()
778
- .describe("Chart type for Chart components"),
839
+ chartType: z.string().optional().describe("Chart sub-type"),
779
840
  columnSpan: z.number().int().min(1).max(3).default(1).describe("Column span (1-3)"),
780
841
  rowSpan: z.number().int().min(1).max(3).default(1).describe("Row span (1-3)"),
781
842
  })).optional().describe("Dashboard components"),
@@ -783,7 +844,8 @@ export const CreateDashboardSchema = z.object({
783
844
  // ─── APEX DEVELOPMENT ────────────────────────────────────────────────────────
784
845
  export const CreateApexClassSchema = z.object({
785
846
  className: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Apex class name, e.g. 'AccountService'"),
786
- classBody: z.string().min(1).max(1_000_000).describe("Full Apex class source code including the class declaration"),
847
+ classBody: z.string().optional().describe("Full Apex class source code including the class declaration"),
848
+ body: z.string().optional().describe("Alias for classBody"),
787
849
  apiVersion: z.string().max(10).default("62.0").describe("API version for this class, e.g. '62.0'"),
788
850
  }).strict();
789
851
  export const CreateApexTriggerSchema = z.object({
@@ -792,12 +854,15 @@ export const CreateApexTriggerSchema = z.object({
792
854
  events: z.array(z.enum(["before insert", "before update", "before delete",
793
855
  "after insert", "after update", "after delete", "after undelete"]))
794
856
  .min(1).describe("Trigger events, e.g. ['before insert', 'before update']"),
795
- triggerBody: z.string().min(1).max(1_000_000).describe("Full trigger body code (the code between the trigger { })"),
857
+ triggerBody: z.string().optional().describe("Full trigger body code (the code between the trigger { })"),
858
+ body: z.string().optional().describe("Alias for triggerBody"),
796
859
  apiVersion: z.string().max(10).default("62.0").describe("API version for this trigger"),
797
860
  }).strict();
798
861
  export const CreateApexTestClassSchema = z.object({
799
862
  className: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Test class name, e.g. 'AccountServiceTest'"),
800
- classBody: z.string().min(1).max(1_000_000).describe("Full test class source code including @isTest annotation and class declaration"),
863
+ classBody: z.string().optional().describe("Full test class source code including @isTest annotation and class declaration"),
864
+ body: z.string().optional().describe("Alias for classBody"),
865
+ targetClass: z.string().optional().describe("Class being tested (informational)"),
801
866
  apiVersion: z.string().max(10).default("62.0").describe("API version for this test class"),
802
867
  runAfterDeploy: z.boolean().default(false).describe("Immediately run the tests after deploying"),
803
868
  }).strict();
@@ -813,7 +878,8 @@ export const CreateLwcSchema = z.object({
813
878
  componentName: z.string().min(1).max(80).regex(/^[a-z][a-zA-Z0-9]*$/, "Must start lowercase, no underscores or hyphens")
814
879
  .describe("LWC component name in camelCase, e.g. 'accountCard', 'opportunityList'"),
815
880
  html: z.string().min(1).max(500_000).describe("HTML template content (the content of the .html file, including <template> tags)"),
816
- javascript: z.string().min(1).max(500_000).describe("JavaScript controller content (the content of the .js file, including import statements and class)"),
881
+ javascript: z.string().optional().describe("JavaScript controller content (the content of the .js file, including import statements and class)"),
882
+ js: z.string().optional().describe("Alias for javascript"),
817
883
  css: z.string().max(200_000).optional().describe("Optional CSS styles content"),
818
884
  description: z.string().max(1000).optional().describe("Description of the component"),
819
885
  targets: z.array(z.enum([
@@ -835,6 +901,7 @@ export const UpdateLwcSchema = z.object({
835
901
  javascript: z.string().max(500_000).optional().describe("Updated JavaScript controller (leave undefined to keep existing)"),
836
902
  css: z.string().max(200_000).optional().describe("Updated CSS (leave undefined to keep existing)"),
837
903
  apiVersion: z.string().max(10).default("62.0").describe("API version"),
904
+ js: z.string().max(500_000).optional().describe("Alias for javascript field"),
838
905
  }).strict();
839
906
  // ─── EXPERIENCE CLOUD ────────────────────────────────────────────────────────
840
907
  export const CreateExperienceSiteSchema = z.object({
@@ -861,9 +928,10 @@ export const CreateAgentSchema = z.object({
861
928
  agentName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Agent API name, e.g. 'CRM_Record_Creator'. IMMUTABLE after creation."),
862
929
  label: z.string().min(1).max(255).describe("Agent display label, e.g. 'CRM Record Creator'"),
863
930
  description: z.string().max(1000).optional().describe("Agent description"),
864
- type: z.enum(["EinsteinCopilot", "ExternalCopilot"]).default("EinsteinCopilot").describe("Bot type: 'EinsteinCopilot' for internal employee agents (shown in Lightning sidebar), 'ExternalCopilot' for customer-facing Agentforce Service Agents. CANNOT be changed after creation."),
931
+ type: z.enum(["EinsteinCopilot", "ExternalCopilot", "EinsteinServiceAgent"]).default("EinsteinCopilot").describe("Bot type: 'EinsteinCopilot' for internal employee agents, 'ExternalCopilot'/'EinsteinServiceAgent' for customer-facing Service Agents. CANNOT be changed after creation."),
865
932
  systemPrompt: z.string().max(32000).optional().describe("Custom system prompt to override the agent's default behavior and persona. Injected into the agent's context before every conversation."),
866
933
  openingMessage: z.string().max(2000).optional().describe("Welcome message shown to users when they first open the agent (set as welcomeMessage on the Bot)."),
934
+ agentType: z.string().optional().describe("Alias for type field"),
867
935
  }).strict();
868
936
  export const CreateAgentTopicSchema = z.object({
869
937
  topicName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Topic API name, e.g. 'Create_Account_Topic'. Used as the GenAiPlugin developer name."),
@@ -874,6 +942,7 @@ export const CreateAgentTopicSchema = z.object({
874
942
  actions: z.array(z.string().max(80)).optional().describe("Action API names (GenAiFunction developer names) to associate, e.g. ['Create_Account']. Create actions first with sf_create_agent_action."),
875
943
  escalationEnabled: z.boolean().optional().describe("Whether this topic can escalate to a human agent (sets canEscalate on GenAiPlugin). Default: false."),
876
944
  fallbackTopic: z.string().max(80).optional().describe("API name of another GenAiPlugin topic to fall back to if this topic cannot handle the request."),
945
+ agentName: z.string().optional().describe("Agent name (informational, not used in creation)"),
877
946
  }).strict();
878
947
  const AgentParamSchema = z.object({
879
948
  name: z.string().max(80).describe("Parameter API name matching the flow variable name, e.g. 'AccountName'"),
@@ -891,6 +960,10 @@ export const CreateAgentActionSchema = z.object({
891
960
  apexClassName: z.string().max(255).optional().describe("API name of the Apex class to invoke (required when invocationTargetType is ApexClass). Class must have an @InvocableMethod."),
892
961
  inputs: z.array(AgentParamSchema).optional().describe("Input parameters. Each becomes a parameter the LLM collects from the user. Type MUST match the flow variable / Apex param type."),
893
962
  outputs: z.array(AgentParamSchema.omit({ required: true })).optional().describe("Output parameters returned to the agent after execution, e.g. the created record ID"),
963
+ agentName: z.string().optional().describe("Agent name (informational)"),
964
+ topicName: z.string().optional().describe("Topic name (informational)"),
965
+ actionType: z.string().optional().describe("Alias for invocationTargetType"),
966
+ flowApiName: z.string().max(255).optional().describe("Flow API name"),
894
967
  }).strict();
895
968
  export const CreateAgentPlannerSchema = z.object({
896
969
  plannerName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Planner API name, e.g. 'CRM_Creator_Planner'. NOTE: Names are permanently reserved even after deletion — use a unique name."),
@@ -900,20 +973,23 @@ export const CreateAgentPlannerSchema = z.object({
900
973
  dataLibraryName: z.string().max(80).optional().describe("API name of a Data Library (Knowledge Base) to attach to this planner for Knowledge-grounded agents."),
901
974
  }).strict();
902
975
  export const ActivateAgentSchema = z.object({
903
- agentApiName: z.string().min(1).max(80).describe("API name of the agent to activate, e.g. 'CRM_Record_Creator'"),
976
+ agentApiName: z.string().optional().describe("API name of the agent to activate, e.g. 'CRM_Record_Creator'"),
977
+ agentName: z.string().optional().describe("Alias for agentApiName"),
904
978
  }).strict();
905
979
  export const DeactivateAgentSchema = z.object({
906
980
  agentApiName: z.string().min(1).max(80).describe("API name of the agent to deactivate, e.g. 'CRM_Record_Creator'"),
907
981
  }).strict();
908
982
  export const GetAgentSchema = z.object({
909
- agentApiName: z.string().min(1).max(80).describe("Agent API name, e.g. 'CRM_Record_Creator'"),
983
+ agentApiName: z.string().optional().describe("Agent API name, e.g. 'CRM_Record_Creator'"),
984
+ agentName: z.string().optional().describe("Alias for agentApiName"),
910
985
  }).strict();
911
986
  export const UpdateAgentTopicSchema = z.object({
912
- agentApiName: z.string().min(1).max(80).describe("API name of the agent that owns this topic. The agent is automatically deactivated before the update and reactivated after."),
987
+ agentApiName: z.string().optional().describe("API name of the agent that owns this topic. The agent is automatically deactivated before the update and reactivated after."),
988
+ agentName: z.string().optional().describe("Alias for agentApiName"),
913
989
  topicName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Topic API name to update (GenAiPlugin developer name)"),
914
- label: z.string().min(1).max(255).describe("Updated topic display label"),
915
- description: z.string().min(1).max(5000).describe("Updated routing description"),
916
- scope: z.string().min(1).max(5000).describe("Updated scope"),
990
+ label: z.string().max(255).optional().describe("Updated topic display label"),
991
+ description: z.string().max(5000).optional().describe("Updated routing description"),
992
+ scope: z.string().max(5000).optional().describe("Updated scope"),
917
993
  instructions: z.array(z.string().max(2000)).optional().describe("Updated step-by-step instructions (replaces existing)"),
918
994
  actions: z.array(z.string().max(80)).optional().describe("Updated action API names (replaces existing)"),
919
995
  escalationEnabled: z.boolean().optional().describe("Whether this topic can escalate to a human agent"),
@@ -936,19 +1012,25 @@ export const DeleteAgentSchema = z.object({
936
1012
  }).strict();
937
1013
  export const ListAgentsSchema = z.object({}).strict();
938
1014
  export const TestAgentSchema = z.object({
939
- agentApiName: z.string().min(1).max(80).describe("API name of the agent to test, e.g. 'CRM_Record_Creator'"),
940
- message: z.string().min(1).max(5000).describe("Test message to send to the agent, e.g. 'Create an account called Acme Corp'"),
1015
+ agentApiName: z.string().optional().describe("API name of the agent to test, e.g. 'CRM_Record_Creator'"),
1016
+ agentName: z.string().optional().describe("Alias for agentApiName"),
1017
+ message: z.string().optional().describe("Test message to send to the agent, e.g. 'Create an account called Acme Corp'"),
1018
+ testMessage: z.string().optional().describe("Alias for message"),
941
1019
  orgUrl: z.string().url().optional().describe("Override the Agentforce bootstrap URL (defaults to SF_INSTANCE_URL). Required only if your My Domain URL differs from the instance URL."),
942
1020
  }).strict();
943
1021
  export const GetAgentLogsSchema = z.object({
944
1022
  agentApiName: z.string().max(80).optional().describe("Filter logs by agent API name (optional — omit to see all agent activity in the org)"),
945
1023
  limit: z.number().int().min(1).max(200).default(20).describe("Maximum number of log entries to return (default: 20)"),
946
1024
  hoursBack: z.number().min(0.1).max(24).default(1).describe("How many hours back to look (default: 1 hour)"),
1025
+ agentName: z.string().optional().describe("Alias for agentApiName"),
947
1026
  }).strict();
948
1027
  // ─── MCP SERVER MANAGEMENT ───────────────────────────────────────────────────
949
1028
  export const CreateMcpServerSchema = z.object({
950
1029
  serverName: z.string().min(1).max(214).describe("Name for the new MCP server, e.g. 'my-salesforce-server'"),
951
- outputDirectory: z.string().min(1).max(1024).describe("Absolute path to directory where files will be created, e.g. 'C:/projects/my-server'"),
1030
+ outputDirectory: z.string().optional().describe("Absolute path to directory where files will be created, e.g. 'C:/projects/my-server'"),
1031
+ outputPath: z.string().optional().describe("Alias for outputDirectory"),
1032
+ objectNames: z.array(z.string()).optional().describe("Object API names to include"),
1033
+ includeCustomFields: z.boolean().optional().describe("Include custom fields"),
952
1034
  description: z.string().max(1000).optional().describe("Server description"),
953
1035
  salesforceInstanceUrl: z.string().max(255).optional().describe("Salesforce instance URL to pre-configure, e.g. 'https://myorg.salesforce.com'"),
954
1036
  }).strict();
@@ -964,22 +1046,29 @@ export const ListMcpToolsSchema = z.object({
964
1046
  }).strict();
965
1047
  // ─── EXTERNAL APPS & INTEGRATIONS ────────────────────────────────────────────
966
1048
  export const CreateConnectedAppSchema = z.object({
967
- fullName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Connected app API name, e.g. 'My_External_App'"),
1049
+ fullName: z.string().optional().describe("Connected app API name, e.g. 'My_External_App'"),
1050
+ appName: z.string().optional().describe("Alias for fullName"),
968
1051
  label: z.string().min(1).describe("Display label"),
969
1052
  description: z.string().optional().describe("Description"),
970
1053
  contactEmail: z.string().email().describe("Contact email for the app"),
971
- callbackUrls: z.array(z.string()).min(1).describe("OAuth callback URLs, e.g. ['https://myapp.com/oauth/callback']"),
972
- scopes: z.array(z.enum(["api", "web", "full", "chatter_api", "wave_api", "eclair_api",
973
- "visualforce", "content", "openid", "profile", "email", "address", "phone",
974
- "offline_access", "custom_permissions", "pardot_api"]))
975
- .min(1).describe("OAuth scopes to request"),
1054
+ callbackUrls: z.array(z.string()).optional().describe("OAuth callback URLs, e.g. ['https://myapp.com/oauth/callback']"),
1055
+ callbackUrl: z.string().optional().describe("Single callback URL (alias for callbackUrls)"),
1056
+ enableOAuth: z.boolean().optional().describe("Whether to enable OAuth"),
1057
+ oauthScopes: z.array(z.string()).optional().describe("Alias for scopes"),
1058
+ scopes: z.preprocess(
1059
+ (v) => Array.isArray(v) ? v.map(s => typeof s === 'string' ? s.toLowerCase() : s) : v,
1060
+ z.array(z.enum(["api", "web", "full", "chatter_api", "wave_api", "eclair_api",
1061
+ "visualforce", "content", "openid", "profile", "email", "address", "phone",
1062
+ "offline_access", "custom_permissions", "pardot_api"])).default(["api"])
1063
+ ).describe("OAuth scopes to request (lowercase, e.g. 'api', 'web', 'full')"),
976
1064
  consumerKey: z.string().optional().describe("Custom consumer key (auto-generated if not specified)"),
977
1065
  startUrl: z.string().optional().describe("Default start URL after OAuth"),
978
1066
  accessTokenValidity: z.number().int().optional().describe("Access token validity in minutes"),
979
1067
  refreshTokenValidity: z.number().int().optional().describe("Refresh token validity in minutes"),
980
1068
  }).strict();
981
1069
  export const CreateExternalDataSourceSchema = z.object({
982
- fullName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("External data source API name"),
1070
+ fullName: z.string().optional().describe("External data source API name"),
1071
+ dataSourceName: z.string().optional().describe("Alias for fullName"),
983
1072
  label: z.string().min(1).describe("Display label"),
984
1073
  type: z.enum(["SimpleURL", "OData2", "OData4", "Apex", "Files", "MuleSoft"]).default("SimpleURL")
985
1074
  .describe("Connection type: SimpleURL for basic, OData2/OData4 for OData, Apex for custom"),
@@ -1003,9 +1092,11 @@ export const CreateExternalObjectSchema = z.object({
1003
1092
  fields: z.array(MetadataFieldSchema).optional().describe("Custom fields to add"),
1004
1093
  }).strict();
1005
1094
  export const CreateRemoteSiteSettingSchema = z.object({
1006
- fullName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Remote site setting API name"),
1007
- name: z.string().min(1).describe("Display name"),
1008
- url: z.string().url().describe("URL to whitelist for callouts, e.g. 'https://api.example.com'"),
1095
+ fullName: z.string().optional().describe("Remote site setting API name"),
1096
+ siteName: z.string().optional().describe("Alias for fullName/name"),
1097
+ name: z.string().optional().describe("Display name"),
1098
+ url: z.string().optional().describe("URL to whitelist for callouts, e.g. 'https://api.example.com'"),
1099
+ siteUrl: z.string().optional().describe("Alias for url"),
1009
1100
  description: z.string().optional().describe("Description of why this site is trusted"),
1010
1101
  isActive: z.boolean().default(true).describe("Whether this remote site setting is active"),
1011
1102
  disableProtocolSecurity: z.boolean().default(false).describe("Disable protocol security (not recommended)"),
@@ -1013,10 +1104,12 @@ export const CreateRemoteSiteSettingSchema = z.object({
1013
1104
  export const CreateCspSettingSchema = z.object({
1014
1105
  endpointUrl: z.string().url().describe("Trusted URL for CSP, e.g. 'https://cdn.example.com'"),
1015
1106
  cspDirectives: z.array(z.enum(["connect-src", "font-src", "frame-src", "img-src",
1016
- "media-src", "object-src", "script-src", "style-src"])).min(1)
1107
+ "media-src", "object-src", "script-src", "style-src"])).optional()
1017
1108
  .describe("CSP directives this URL is trusted for"),
1018
1109
  description: z.string().optional().describe("Description of why this URL is trusted"),
1019
1110
  isActive: z.boolean().default(true).describe("Whether this setting is active"),
1111
+ policyName: z.string().optional().describe("Policy name (informational)"),
1112
+ directives: z.array(z.string()).optional().describe("Alias for cspDirectives"),
1020
1113
  }).strict();
1021
1114
  // ─── CHANGE SETS & DEPLOYMENT ────────────────────────────────────────────────
1022
1115
  export const ComponentRefSchema = z.object({
@@ -1044,12 +1137,15 @@ export const CheckDeployStatusSchema = z.object({
1044
1137
  deployId: z.string().min(1).describe("Deploy async job ID returned from sf_deploy_metadata"),
1045
1138
  }).strict();
1046
1139
  export const RetrieveMetadataSchema = z.object({
1047
- components: z.array(ComponentRefSchema).min(1).describe("Metadata components to retrieve"),
1140
+ components: z.array(ComponentRefSchema).optional().describe("Metadata components to retrieve"),
1141
+ metadataType: z.string().optional().describe("Single metadata type (alternative to components array)"),
1142
+ componentName: z.string().optional().describe("Single component name (used with metadataType)"),
1048
1143
  packageXml: z.string().optional().describe("Raw package.xml content for selective retrieve. If provided, components list is ignored."),
1049
1144
  }).strict();
1050
1145
  // ─── OBJECTS & FIELDS (v2.2.0) ───────────────────────────────────────────────
1051
1146
  export const UpdateCustomObjectSchema = z.object({
1052
- objectApiName: z.string().min(1).describe("Custom object API name, e.g. 'MyObject__c'"),
1147
+ objectApiName: z.string().optional().describe("Custom object API name, e.g. 'MyObject__c'"),
1148
+ fullName: z.string().optional().describe("Alias for objectApiName"),
1053
1149
  label: z.string().optional().describe("New singular label"),
1054
1150
  pluralLabel: z.string().optional().describe("New plural label"),
1055
1151
  description: z.string().optional().describe("New description"),
@@ -1059,8 +1155,10 @@ export const UpdateCustomObjectSchema = z.object({
1059
1155
  enableActivities: z.boolean().optional().describe("Enable activities (tasks and events)"),
1060
1156
  }).strict();
1061
1157
  export const UpdateCustomFieldSchema = z.object({
1062
- objectApiName: z.string().min(1).describe("Object API name, e.g. 'Account'"),
1063
- fieldApiName: z.string().min(1).describe("Field API name, e.g. 'MyField__c'"),
1158
+ objectApiName: z.string().optional().describe("Object API name, e.g. 'Account'"),
1159
+ objectName: z.string().optional().describe("Alias for objectApiName"),
1160
+ fieldApiName: z.string().optional().describe("Field API name, e.g. 'MyField__c'"),
1161
+ fieldName: z.string().optional().describe("Alias for fieldApiName"),
1064
1162
  label: z.string().optional().describe("New field label"),
1065
1163
  description: z.string().optional().describe("New description"),
1066
1164
  helpText: z.string().optional().describe("New inline help text"),
@@ -1069,11 +1167,14 @@ export const UpdateCustomFieldSchema = z.object({
1069
1167
  defaultValue: z.string().optional().describe("New default value"),
1070
1168
  }).strict();
1071
1169
  export const CreateRelationshipFieldSchema = z.object({
1072
- objectApiName: z.string().min(1).describe("Object API name to create the field on, e.g. 'Contact'"),
1170
+ objectApiName: z.string().optional().describe("Object API name to create the field on, e.g. 'Contact'"),
1171
+ objectName: z.string().optional().describe("Alias for objectApiName"),
1073
1172
  fieldName: z.string().min(1).max(40).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Field name without __c suffix, e.g. 'Account'"),
1074
1173
  label: z.string().min(1).describe("Field label"),
1075
- relationshipType: z.enum(["Lookup","MasterDetail"]).describe("Lookup: optional reference field. MasterDetail: required parent-child relationship (child deleted with parent)."),
1076
- relatedObject: z.string().min(1).describe("API name of the related (parent) object, e.g. 'Account'"),
1174
+ relationshipType: z.enum(["Lookup","MasterDetail"]).optional().describe("Lookup: optional reference field. MasterDetail: required parent-child relationship (child deleted with parent)."),
1175
+ relationType: z.enum(["Lookup","MasterDetail"]).optional().describe("Alias for relationshipType"),
1176
+ relatedObject: z.string().optional().describe("API name of the related (parent) object, e.g. 'Account'"),
1177
+ referenceTo: z.string().optional().describe("Alias for relatedObject"),
1077
1178
  relationshipName: z.string().min(1).describe("Relationship API name used in SOQL, e.g. 'Account' (no spaces or double underscores)"),
1078
1179
  onDelete: z.enum(["SetNull","Restrict"]).default("SetNull").describe("Lookup only — what happens to child when parent is deleted: SetNull (clears field) or Restrict (blocks deletion)"),
1079
1180
  required: z.boolean().default(false).describe("Make field required (Lookup only; MasterDetail is always required)"),
@@ -1101,7 +1202,7 @@ export const CreatePermissionSetGroupSchema = z.object({
1101
1202
  permissionSets: z.array(z.string().min(1)).min(1).describe("Array of Permission Set API names to include in this group"),
1102
1203
  }).strict();
1103
1204
  const ObjPermSchema = z.object({
1104
- object: z.string().min(1).describe("Object API name, e.g. 'Account'"),
1205
+ object: z.string().optional().describe("Object API name, e.g. 'Account'"),
1105
1206
  read: z.boolean().default(false),
1106
1207
  create: z.boolean().default(false),
1107
1208
  edit: z.boolean().default(false),
@@ -1120,31 +1221,46 @@ export const UpdatePermissionSetSchema = z.object({
1120
1221
  fieldPermissions: z.array(FldPermSchema).optional().describe("Field-level security to set. Replaces existing FLS for specified fields."),
1121
1222
  }).strict();
1122
1223
  export const CreateMutingPermissionSetSchema = z.object({
1123
- mutingPermSetName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Muting Permission Set API name"),
1224
+ mutingPermSetName: z.string().optional().describe("Muting Permission Set API name"),
1225
+ permissionSetName: z.string().optional().describe("Alias for mutingPermSetName"),
1226
+ description: z.string().optional().describe("Description"),
1124
1227
  label: z.string().min(1).describe("Display label"),
1125
1228
  permissionSetGroup: z.string().optional().describe("Permission Set Group API name to add this muting perm set to"),
1126
1229
  objectPermissions: z.array(ObjPermSchema).optional().describe("Object permissions to mute (suppress)"),
1127
1230
  fieldPermissions: z.array(FldPermSchema).optional().describe("Field permissions to mute"),
1128
1231
  }).strict();
1129
1232
  export const SetFieldLevelSecuritySchema = z.object({
1130
- fieldApiName: z.string().min(1).describe("Field in Object.Field format, e.g. 'Account.AnnualRevenue'"),
1233
+ fieldApiName: z.string().optional().describe("Field in Object.Field format, e.g. 'Account.AnnualRevenue'"),
1234
+ permissionSetName: z.string().optional().describe("Single permission set name"),
1235
+ objectName: z.string().optional().describe("Object API name (informational)"),
1236
+ fields: z.array(z.object({
1237
+ field: z.string().describe("Field API name"),
1238
+ readable: z.boolean().optional(),
1239
+ editable: z.boolean().optional(),
1240
+ })).optional().describe("Array of field FLS settings"),
1131
1241
  profiles: z.array(z.string()).optional().describe("Profile API names to update FLS for"),
1132
1242
  permissionSets: z.array(z.string()).optional().describe("Permission Set API names to update FLS for"),
1133
- readable: z.boolean().describe("Grant read access to this field"),
1134
- editable: z.boolean().describe("Grant edit access to this field (read is implied if editable)"),
1243
+ readable: z.boolean().optional().describe("Grant read access to this field"),
1244
+ editable: z.boolean().optional().describe("Grant edit access to this field (read is implied if editable)"),
1135
1245
  }).strict();
1136
1246
  export const SetOrgWideDefaultsSchema = z.object({
1137
- objectApiName: z.string().min(1).describe("Object API name, e.g. 'Opportunity__c'. For standard objects like Account, use the object API name."),
1138
- defaultInternal: z.enum(["Private","PublicRead","PublicReadWrite","ControlledByParent"]).describe("Internal org-wide default sharing model"),
1247
+ objectApiName: z.string().optional().describe("Object API name, e.g. 'Opportunity__c'. For standard objects like Account, use the object API name."),
1248
+ objectName: z.string().optional().describe("Alias for objectApiName"),
1249
+ defaultInternal: z.enum(["Private","PublicRead","PublicReadWrite","ControlledByParent"]).optional().describe("Internal org-wide default sharing model"),
1250
+ defaultAccess: z.string().optional().describe("Alias for defaultInternal: Private, PublicRead, PublicReadWrite"),
1251
+ externalAccess: z.string().optional().describe("External org-wide default sharing"),
1139
1252
  defaultExternal: z.enum(["Private","PublicRead","PublicReadWrite","ControlledByParent"]).optional().describe("External org-wide default (for orgs with external sharing model enabled)"),
1140
1253
  }).strict();
1141
1254
  export const CreateProfileSchema = z.object({
1142
- profileName: z.string().min(1).max(80).describe("New profile API name"),
1143
- label: z.string().min(1).describe("New profile display label"),
1144
- cloneFrom: z.string().min(1).describe("API name of existing profile to clone, e.g. 'Standard User'"),
1255
+ profileName: z.string().optional().describe("New profile API name"),
1256
+ newProfileName: z.string().optional().describe("Alias for profileName"),
1257
+ label: z.string().optional().describe("New profile display label"),
1258
+ cloneFrom: z.string().optional().describe("API name of existing profile to clone, e.g. 'Standard User'"),
1259
+ sourceProfileName: z.string().optional().describe("Alias for cloneFrom"),
1260
+ description: z.string().optional().describe("Profile description"),
1145
1261
  }).strict();
1146
1262
  const ProfileObjPermSchema = z.object({
1147
- object: z.string().min(1).describe("Object API name"),
1263
+ object: z.string().optional().describe("Object API name"),
1148
1264
  allowCreate: z.boolean().default(false),
1149
1265
  allowDelete: z.boolean().default(false),
1150
1266
  allowEdit: z.boolean().default(false),
@@ -1162,16 +1278,23 @@ export const UpdateProfileSchema = z.object({
1162
1278
  // ─── PAGE LAYOUTS & UI (v2.2.0) ──────────────────────────────────────────────
1163
1279
  export const UpdatePageLayoutSchema = z.object({
1164
1280
  layoutName: z.string().min(1).describe("Layout full name in 'Object-Layout Name' format, e.g. 'Account-Account Layout'"),
1165
- fieldsToAdd: z.array(z.object({ field: z.string(), section: z.string().optional(), column: z.number().int().min(0).max(1).default(0) })).optional().describe("Fields to add to the layout"),
1281
+ fieldsToAdd: z.array(z.union([
1282
+ z.string().transform(s => ({ field: s })),
1283
+ z.object({ field: z.string(), section: z.string().optional(), column: z.number().int().min(0).max(1).default(0) }),
1284
+ ])).optional().describe("Fields to add: field API name strings or {field, section?, column?} objects"),
1166
1285
  fieldsToRemove: z.array(z.string()).optional().describe("Field API names to remove from the layout"),
1167
1286
  relatedListsToAdd: z.array(z.string()).optional().describe("Related list API names to add, e.g. 'Contacts'"),
1168
1287
  relatedListsToRemove: z.array(z.string()).optional().describe("Related list API names to remove"),
1169
1288
  buttonsToAdd: z.array(z.string()).optional().describe("Custom button names to add to the layout"),
1289
+ objectName: z.string().optional().describe("Object API name (informational)"),
1290
+ sections: z.array(z.any()).optional().describe("Page layout sections"),
1170
1291
  }).strict();
1171
1292
  export const AssignPageLayoutSchema = z.object({
1172
- objectApiName: z.string().min(1).describe("Object API name, e.g. 'Account'"),
1293
+ objectApiName: z.string().optional().describe("Object API name, e.g. 'Account'"),
1294
+ objectName: z.string().optional().describe("Alias for objectApiName"),
1173
1295
  layoutName: z.string().min(1).describe("Layout name (without object prefix), e.g. 'Account Layout'"),
1174
- profileName: z.string().min(1).describe("Profile API name to assign the layout to"),
1296
+ profileName: z.string().optional().describe("Profile API name to assign the layout to"),
1297
+ profiles: z.array(z.string()).optional().describe("Array of profile names (alternative to profileName)"),
1175
1298
  recordTypeName: z.string().optional().describe("Record type developer name (if assigning to a specific record type)"),
1176
1299
  }).strict();
1177
1300
  const FlexiComponentSchema = z.object({
@@ -1206,14 +1329,15 @@ export const AssignLightningPageSchema = z.object({
1206
1329
  objectApiName: z.string().optional().describe("Object API name (for record page assignments)"),
1207
1330
  }).strict();
1208
1331
  export const AssignCompactLayoutSchema = z.object({
1209
- objectApiName: z.string().min(1).describe("Object API name, e.g. 'Account'"),
1332
+ objectApiName: z.string().optional().describe("Object API name, e.g. 'Account'"),
1333
+ objectName: z.string().optional().describe("Alias for objectApiName"),
1210
1334
  compactLayoutName: z.string().min(1).describe("Compact layout API name to assign as default"),
1211
1335
  recordTypeName: z.string().optional().describe("Record type developer name (if assigning to a specific record type)"),
1212
1336
  }).strict();
1213
1337
  // ─── AUTOMATION (v2.2.0) ─────────────────────────────────────────────────────
1214
1338
  export const ActivateFlowSchema = z.object({
1215
1339
  flowApiName: z.string().min(1).describe("Flow API name (DeveloperName), e.g. 'My_Flow'"),
1216
- action: z.enum(["activate","deactivate"]).describe("Whether to activate or deactivate the flow"),
1340
+ action: z.enum(["activate","deactivate"]).default("activate").describe("Whether to activate or deactivate the flow"),
1217
1341
  versionNumber: z.number().int().optional().describe("Specific version number to activate. Defaults to latest version."),
1218
1342
  }).strict();
1219
1343
  export const CreateQuickActionSchema = z.object({
@@ -1224,6 +1348,8 @@ export const CreateQuickActionSchema = z.object({
1224
1348
  targetFields: z.array(z.object({ field: z.string(), value: z.string() })).optional().describe("Pre-populated field values"),
1225
1349
  standardLabel: z.enum(["None","New","NewEvent","NewTask","LogACall","SendEmail","NewCase","NewOpportunity","NewContact","NewLead","NewNote","NewAccount","ScreenPop"]).optional().describe("Standard action label type"),
1226
1350
  description: z.string().optional().describe("Action description"),
1351
+ objectName: z.string().optional().describe("Object API name (informational prefix)"),
1352
+ fields: z.array(z.any()).optional().describe("Alias for targetFields"),
1227
1353
  }).strict();
1228
1354
  // ─── APEX & LWC (v2.2.0) ─────────────────────────────────────────────────────
1229
1355
  export const UpdateApexClassSchema = z.object({
@@ -1240,7 +1366,8 @@ export const GetCodeCoverageSchema = z.object({
1240
1366
  export const CreateVisualforcePageSchema = z.object({
1241
1367
  pageName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Visualforce page API name"),
1242
1368
  label: z.string().min(1).describe("Page label"),
1243
- markup: z.string().min(1).describe("Full Visualforce page markup (including <apex:page> tag)"),
1369
+ markup: z.string().optional().describe("Full Visualforce page markup (including <apex:page> tag)"),
1370
+ body: z.string().optional().describe("Alias for markup"),
1244
1371
  apiVersion: z.string().default("66.0").describe("API version"),
1245
1372
  availableInTouch: z.boolean().default(false).describe("Make available in Salesforce mobile"),
1246
1373
  showHeader: z.boolean().default(true).describe("Show Salesforce header"),
@@ -1272,6 +1399,7 @@ export const CreateReportSchema = z.object({
1272
1399
  columns: z.array(z.string()).min(1).describe("Field API names to include as columns, e.g. ['ACCOUNT_NAME', 'ANNUAL_REVENUE']"),
1273
1400
  filters: z.array(ReportFilterSchema).optional().describe("Report filters"),
1274
1401
  description: z.string().optional().describe("Report description"),
1402
+ folderName: z.string().optional().describe("Folder API name for the report"),
1275
1403
  }).strict();
1276
1404
  export const UpdateDashboardSchema = z.object({
1277
1405
  dashboardName: z.string().min(1).describe("Dashboard API name"),
@@ -1283,25 +1411,31 @@ export const UpdateDashboardSchema = z.object({
1283
1411
  column: z.number().int().default(0).describe("Column position (0-based)"),
1284
1412
  })).optional().describe("Dashboard components to add"),
1285
1413
  componentsToRemove: z.array(z.string()).optional().describe("Component titles to remove"),
1414
+ label: z.string().optional().describe("New dashboard title/label"),
1415
+ runningUser: z.string().optional().describe("Username to run dashboard as"),
1286
1416
  }).strict();
1287
1417
  export const CreateReportFolderSchema = z.object({
1288
1418
  folderName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Folder API name"),
1289
1419
  label: z.string().min(1).describe("Folder display name"),
1290
- folderType: z.enum(["Report","Dashboard"]).describe("Whether this is a report or dashboard folder"),
1420
+ folderType: z.enum(["Report","Dashboard"]).default("Report").describe("Whether this is a report or dashboard folder"),
1291
1421
  accessType: z.enum(["Hidden","Shared","Public"]).default("Shared").describe("Folder access type"),
1292
1422
  }).strict();
1293
1423
  export const ShareReportFolderSchema = z.object({
1294
1424
  folderName: z.string().min(1).describe("Folder API name to share"),
1295
- folderType: z.enum(["Report","Dashboard"]).describe("Whether this is a report or dashboard folder"),
1296
- shareWith: z.array(z.object({
1297
- type: z.enum(["Role","Group","User","RoleAndSubordinates"]).describe("Sharing target type"),
1298
- name: z.string().describe("API name/username of the role, group, or user"),
1299
- accessLevel: z.enum(["View","Edit","Manage"]).default("View").describe("Access level"),
1300
- })).min(1).describe("Who to share the folder with"),
1425
+ folderType: z.enum(["Report","Dashboard"]).default("Report").describe("Whether this is a report or dashboard folder"),
1426
+ accessLevel: z.string().optional().describe("Access level shorthand: View, Edit, Manage"),
1427
+ shareWith: z.preprocess(
1428
+ (v) => typeof v === 'string' ? [{ type: "Group", name: v, accessLevel: "View" }] : v,
1429
+ z.array(z.object({
1430
+ type: z.enum(["Role","Group","User","RoleAndSubordinates"]).describe("Sharing target type"),
1431
+ name: z.string().describe("API name/username of the role, group, or user"),
1432
+ accessLevel: z.enum(["View","Edit","Manage"]).default("View").describe("Access level"),
1433
+ })).min(1)
1434
+ ).describe("Who to share the folder with"),
1301
1435
  }).strict();
1302
1436
  // ─── USERS & DATA (v2.2.0) ───────────────────────────────────────────────────
1303
1437
  export const CreateUserSchema = z.object({
1304
- firstName: z.string().min(1).describe("First name"),
1438
+ firstName: z.string().optional().describe("First name"),
1305
1439
  lastName: z.string().min(1).describe("Last name"),
1306
1440
  email: z.string().email().describe("Email address (also used for notifications)"),
1307
1441
  username: z.string().email().describe("Unique username (must be email format and unique across all Salesforce orgs)"),
@@ -1360,6 +1494,7 @@ export const CreateOutboundMessageSchema = z.object({
1360
1494
  endpointUrl: z.string().url().describe("HTTPS endpoint URL to send the SOAP message to"),
1361
1495
  fields: z.array(z.string()).min(1).describe("Field API names to include in the outbound message payload"),
1362
1496
  useCallout: z.boolean().default(false).describe("Whether to use a named credential callout"),
1497
+ integrationUser: z.string().optional().describe("Username of the integration user (defaults to current user)"),
1363
1498
  description: z.string().optional().describe("Description"),
1364
1499
  }).strict();
1365
1500
  export const CreateAuthProviderSchema = z.object({
@@ -1370,6 +1505,8 @@ export const CreateAuthProviderSchema = z.object({
1370
1505
  consumerSecret: z.string().min(1).describe("OAuth consumer secret / client secret"),
1371
1506
  defaultScopes: z.string().optional().describe("Default OAuth scopes, e.g. 'openid email profile'"),
1372
1507
  customErrorUrl: z.string().url().optional().describe("Custom error page URL"),
1508
+ authorizeEndpointUrl: z.string().optional().describe("Authorization endpoint URL"),
1509
+ tokenEndpointUrl: z.string().optional().describe("Token endpoint URL"),
1373
1510
  }).strict();
1374
1511
  // ─── DEPLOYMENT (v2.2.0) ──────────────────────────────────────────────────────
1375
1512
  export const ValidateDeploymentSchema = z.object({
@@ -1394,12 +1531,14 @@ export const UpdateExperienceSiteSchema = z.object({
1394
1531
  export const CreateNavigationMenuSchema = z.object({
1395
1532
  menuName: z.string().min(1).max(80).describe("Navigation menu API name"),
1396
1533
  label: z.string().min(1).describe("Menu label"),
1534
+ networkName: z.string().optional().describe("Experience site name (informational)"),
1535
+ items: z.array(z.any()).optional().describe("Alias for menuItems"),
1397
1536
  menuItems: z.array(z.object({
1398
1537
  label: z.string().describe("Menu item label"),
1399
1538
  type: z.enum(["SalesforceObject","ExternalUrl","NavigationalTopic","Event","MenuLabel","GlobalAction","ContentPage"]).describe("Menu item type"),
1400
- target: z.string().describe("Target: object API name, URL, topic name, or event name"),
1539
+ target: z.string().optional().describe("Target: object API name, URL, topic name, or event name"),
1401
1540
  position: z.number().int().optional().describe("Position (1-based)"),
1402
- })).min(1).describe("Navigation menu items"),
1541
+ })).optional().describe("Navigation menu items"),
1403
1542
  }).strict();
1404
1543
  export const CreateExperienceSiteMemberSchema = z.object({
1405
1544
  siteName: z.string().min(1).describe("Experience Cloud site API name"),
@@ -1453,7 +1592,7 @@ const OmniElementSchema = z.object({
1453
1592
  properties: z.record(z.unknown()).optional().describe("Element-specific configuration properties"),
1454
1593
  });
1455
1594
  export const CreateOmniScriptSchema = z.object({
1456
- scriptName: z.string().min(1).max(80).describe("API name identifier portion (used in fullName as Type_SubType_Language)"),
1595
+ scriptName: z.string().min(1).max(80).optional().describe("Ignored — fullName is derived from type_subType_language"),
1457
1596
  label: z.string().min(1).max(255),
1458
1597
  type: z.string().min(1).describe("OmniScript type, e.g. 'Account', 'Claims'"),
1459
1598
  subType: z.string().min(1).describe("OmniScript sub-type, e.g. 'Create', 'Edit'"),
@@ -1555,12 +1694,15 @@ export const CreateCalculationProcedureSchema = z.object({
1555
1694
  export const CreateServiceChannelSchema = z.object({
1556
1695
  channelName: z.string().min(1).max(80).describe("API name / DeveloperName of the Service Channel"),
1557
1696
  label: z.string().min(1).max(255),
1558
- channelType: z.enum(["Case","Chat","Messaging","Voice","Email","SocialPost","Custom"]).default("Case"),
1697
+ channelType: z.enum(["Case","Chat","Messaging","Voice","Email","SocialPost","Custom","Standard"]).default("Case"),
1559
1698
  relatedObjectApiName: z.string().optional().describe("SObject routed via this channel, default 'Case'"),
1560
1699
  capacity: z.number().int().min(1).max(100).default(1).describe("Capacity weight for this channel"),
1700
+ relatedObject: z.string().optional().describe("Alias for relatedObjectApiName"),
1561
1701
  }).strict();
1562
1702
  export const CreateRoutingConfigurationSchema = z.object({
1563
- configName: z.string().min(1).max(80).describe("API name of the RoutingConfiguration"),
1703
+ configName: z.string().optional().describe("API name of the RoutingConfiguration"),
1704
+ routingConfigName: z.string().optional().describe("Alias for configName"),
1705
+ routingPriority: z.number().int().optional().describe("Alias for priority"),
1564
1706
  label: z.string().min(1).max(255),
1565
1707
  routingModel: z.enum(["LeastActive","MostAvailable","ExternalRouting"]).default("LeastActive"),
1566
1708
  capacity: z.number().min(0).max(100).default(100).describe("Capacity percentage or item count"),
@@ -1577,7 +1719,10 @@ export const CreatePresenceConfigurationSchema = z.object({
1577
1719
  configName: z.string().min(1).max(80).describe("API name of the PresenceUserConfig"),
1578
1720
  label: z.string().min(1).max(255),
1579
1721
  capacity: z.number().int().min(1).max(100).default(10).describe("Maximum concurrent work items per agent"),
1580
- serviceChannels: z.array(z.object({ channelName: z.string().min(1), capacity: z.number().int().min(1).optional() })).optional(),
1722
+ serviceChannels: z.array(z.union([
1723
+ z.string().transform(s => ({ channelName: s })),
1724
+ z.object({ channelName: z.string().min(1), capacity: z.number().int().min(1).optional() }),
1725
+ ])).optional(),
1581
1726
  allowAgentsToChangeStatus: z.boolean().default(true),
1582
1727
  description: z.string().optional(),
1583
1728
  }).strict();
@@ -1626,7 +1771,7 @@ export const CreateWorkTypeSchema = z.object({
1626
1771
  export const CreateMessagingChannelSchema = z.object({
1627
1772
  channelName: z.string().min(1).max(80).describe("API name / MasterLabel for the Messaging Channel"),
1628
1773
  label: z.string().min(1).max(255),
1629
- channelType: z.enum(["SMS","WhatsApp","Facebook","AppleMessages","GoogleBusinessMessages","LINE","Voice"]),
1774
+ channelType: z.enum(["SMS","WhatsApp","Facebook","AppleMessages","GoogleBusinessMessages","LINE","Voice","EmbeddedMessaging"]),
1630
1775
  phoneNumber: z.string().optional().describe("Phone number for SMS/WhatsApp channels"),
1631
1776
  pageId: z.string().optional().describe("Facebook Page ID for Facebook Messenger"),
1632
1777
  routingType: z.enum(["Queue","Bot","None"]).default("Queue"),
@@ -1647,10 +1792,11 @@ export const CreateChatButtonSchema = z.object({
1647
1792
  description: z.string().optional(),
1648
1793
  }).strict();
1649
1794
  export const CreateEmbeddedServiceSchema = z.object({
1650
- deploymentName: z.string().min(1).max(80).describe("API name of the Embedded Service deployment"),
1795
+ deploymentName: z.string().optional().describe("API name of the Embedded Service deployment"),
1796
+ serviceName: z.string().optional().describe("Alias for deploymentName"),
1651
1797
  label: z.string().min(1).max(255),
1652
1798
  site: z.string().min(1).describe("Experience Cloud site name or 'none' for non-community deployment"),
1653
- channelType: z.enum(["LiveAgent","MessagingChannel"]).default("LiveAgent"),
1799
+ channelType: z.enum(["LiveAgent","MessagingChannel","EmbeddedMessaging"]).default("LiveAgent"),
1654
1800
  chatButtonName: z.string().optional().describe("LiveChatButton API name (for LiveAgent)"),
1655
1801
  messagingChannelName: z.string().optional().describe("MessagingChannel API name (for MessagingChannel)"),
1656
1802
  primaryColor: z.string().optional().describe("Primary brand color hex, e.g. '#0070D2'"),
@@ -1680,49 +1826,56 @@ export const DeleteRecordSchema = z.object({
1680
1826
  recordId: z.string().min(15).max(18).describe("15 or 18 character Salesforce record ID"),
1681
1827
  }).strict();
1682
1828
  export const GetSetupAuditTrailSchema = z.object({
1683
- startDate: z.string().describe("Start date in ISO format, e.g. '2025-01-01'"),
1684
- endDate: z.string().describe("End date in ISO format, e.g. '2025-12-31'"),
1829
+ startDate: z.string().optional().describe("Start date in ISO format, e.g. '2025-01-01'"),
1830
+ endDate: z.string().optional().describe("End date in ISO format, e.g. '2025-12-31'"),
1685
1831
  createdByUsername: z.string().optional().describe("Filter by the username who made the change"),
1686
1832
  section: z.string().optional().describe("Filter by section, e.g. 'Custom Fields', 'Profiles', 'Flows', 'Apex Classes'"),
1687
1833
  limit: z.number().int().min(1).max(2000).default(100).describe("Maximum records to return"),
1688
1834
  }).strict();
1689
1835
  export const GetLoginHistorySchema = z.object({
1690
- startDate: z.string().describe("Start date in ISO format, e.g. '2025-01-01'"),
1691
- endDate: z.string().describe("End date in ISO format, e.g. '2025-12-31'"),
1836
+ startDate: z.string().optional().describe("Start date in ISO format, e.g. '2025-01-01'"),
1837
+ endDate: z.string().optional().describe("End date in ISO format, e.g. '2025-12-31'"),
1692
1838
  username: z.string().optional().describe("Filter by Salesforce username"),
1693
1839
  status: z.string().optional().describe("Filter by login status, e.g. 'Success', 'Failed'"),
1694
1840
  limit: z.number().int().min(1).max(2000).default(100).describe("Maximum records to return"),
1695
1841
  }).strict();
1696
1842
  export const GetEventLogsSchema = z.object({
1697
1843
  eventType: z.string().describe("Event type, e.g. 'Login', 'API', 'Report', 'Flow', 'ApexExecution', 'LightningPageView', 'RestApi'"),
1698
- startDate: z.string().describe("Start date in ISO format, e.g. '2025-01-01'"),
1699
- endDate: z.string().describe("End date in ISO format, e.g. '2025-12-31'"),
1844
+ startDate: z.string().optional().describe("Start date in ISO format, e.g. '2025-01-01'"),
1845
+ endDate: z.string().optional().describe("End date in ISO format, e.g. '2025-12-31'"),
1700
1846
  limit: z.number().int().min(1).max(50).default(10).describe("Maximum log files to fetch"),
1701
1847
  }).strict();
1702
1848
  export const GetFieldHistorySchema = z.object({
1703
1849
  objectApiName: z.string().min(1).describe("Object API name, e.g. 'Account', 'Case', 'Opportunity'"),
1704
- recordId: z.string().min(15).max(18).describe("Record ID to fetch history for"),
1850
+ recordId: z.string().min(15).describe("Record ID to fetch history for (15 or 18 characters)"),
1705
1851
  fields: z.array(z.string()).optional().describe("Optional field names to filter — returns all tracked fields if omitted"),
1706
1852
  limit: z.number().int().min(1).max(500).default(100).describe("Maximum history records to return"),
1707
1853
  }).strict();
1708
1854
  export const CompareOrgsSchema = z.object({
1709
- sourceAlias: z.string().min(1).regex(/^[A-Za-z0-9_-]+$/).describe("SF CLI alias for the source org (run: sf org list to see aliases)"),
1710
- targetAlias: z.string().min(1).regex(/^[A-Za-z0-9_-]+$/).describe("SF CLI alias for the target org"),
1855
+ sourceAlias: z.string().optional().describe("SF CLI alias for the source org (run: sf org list to see aliases)"),
1856
+ targetAlias: z.string().optional().describe("SF CLI alias for the target org"),
1857
+ metadataType: z.string().optional().describe("Single metadata type to compare"),
1858
+ limit: z.number().int().optional().describe("Maximum results to return"),
1711
1859
  metadataTypes: z.array(z.string()).default(["ApexClass","Flow","CustomObject","PermissionSet","LightningComponentBundle"]).describe("Metadata types to compare"),
1712
1860
  }).strict();
1713
1861
  export const CreateCertificateSchema = z.object({
1714
1862
  certName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Certificate API name"),
1715
1863
  label: z.string().min(1).describe("Certificate display label"),
1716
- keySize: z.enum(["2048","4096"]).default("2048").describe("Key size in bits"),
1864
+ keySize: z.preprocess(
1865
+ (v) => typeof v === 'number' ? String(v) : v,
1866
+ z.enum(["2048","4096"]).default("2048")
1867
+ ).describe("Key size in bits: 2048 or 4096 (number or string)"),
1717
1868
  expirationDate: z.string().optional().describe("Expiration date in ISO format, e.g. '2030-01-01'"),
1718
1869
  privateKeyExportable: z.boolean().default(false).describe("Whether the private key can be exported"),
1719
1870
  }).strict();
1720
1871
  export const CreateEventRelaySchema = z.object({
1721
1872
  relayName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Event relay API name"),
1722
- label: z.string().min(1).describe("Display label"),
1723
- eventChannel: z.string().min(1).describe("Platform event or CDC channel API name, e.g. 'My_Event__e' or 'AccountChangeEvent'"),
1724
- destinationType: z.enum(["AmazonEventBridge","EventBus"]).describe("Destination type for the relay"),
1725
- destinationResourceName: z.string().min(1).describe("ARN or event bus name for the destination"),
1873
+ label: z.string().optional().describe("Display label"),
1874
+ eventChannel: z.string().optional().describe("Platform event or CDC channel API name, e.g. 'My_Event__e' or 'AccountChangeEvent'"),
1875
+ platformEventName: z.string().optional().describe("Alias for eventChannel"),
1876
+ relayChannel: z.string().optional().describe("Channel name for relay"),
1877
+ destinationType: z.enum(["AmazonEventBus","AmazonEventBridge","EventBus"]).optional().describe("Destination type for the relay (AmazonEventBus for Amazon EventBridge, EventBus for Salesforce Event Bus)"),
1878
+ destinationResourceName: z.string().optional().describe("ARN or event bus name for the destination"),
1726
1879
  state: z.enum(["RUN","STOP","PAUSE"]).default("RUN").describe("Initial relay state"),
1727
1880
  description: z.string().optional().describe("Relay description"),
1728
1881
  }).strict();
@@ -1739,6 +1892,7 @@ export const CreateLetterheadSchema = z.object({
1739
1892
  footerText: z.string().optional().describe("Footer text content"),
1740
1893
  topLineColor: z.string().default("#0070D2").describe("Top separator line color"),
1741
1894
  bottomLineColor: z.string().default("#0070D2").describe("Bottom separator line color"),
1895
+ backgroundColor: z.string().optional().describe("Alias for bodyColor"),
1742
1896
  }).strict();
1743
1897
  export const SendEmailSchema = z.object({
1744
1898
  toAddresses: z.array(z.string()).min(1).describe("Recipient email addresses"),
@@ -1755,8 +1909,12 @@ export const SendEmailSchema = z.object({
1755
1909
  export const CreateEinsteinPredictionSchema = z.object({
1756
1910
  predictionName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Prediction API name"),
1757
1911
  label: z.string().min(1).describe("Prediction display label"),
1758
- objectApiName: z.string().min(1).describe("Salesforce object to run predictions on, e.g. 'Opportunity'"),
1759
- predictionType: z.enum(["BinaryClassification","Regression"]).describe("BinaryClassification for yes/no, Regression for numeric"),
1912
+ objectApiName: z.string().optional().describe("Salesforce object to run predictions on, e.g. 'Opportunity'"),
1913
+ objectName: z.string().optional().describe("Alias for objectApiName"),
1914
+ predictionType: z.preprocess(
1915
+ (v) => v === 'Classification' ? 'BinaryClassification' : v,
1916
+ z.enum(["BinaryClassification","Regression","Classification"])
1917
+ ).describe("BinaryClassification/Classification for yes/no, Regression for numeric"),
1760
1918
  targetField: z.string().min(1).describe("Field API name to predict"),
1761
1919
  positiveLabel: z.string().default("Yes").describe("Label for positive outcome (BinaryClassification only)"),
1762
1920
  negativeLabel: z.string().default("No").describe("Label for negative outcome (BinaryClassification only)"),
@@ -1766,7 +1924,7 @@ export const CreateEinsteinPredictionSchema = z.object({
1766
1924
  export const CreateNextBestActionSchema = z.object({
1767
1925
  strategyName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Strategy API name"),
1768
1926
  label: z.string().min(1).describe("Strategy display label"),
1769
- contextObjectApiName: z.string().min(1).describe("Object that provides context, e.g. 'Account', 'Case'"),
1927
+ contextObjectApiName: z.string().optional().describe("Object that provides context, e.g. 'Account', 'Case'"),
1770
1928
  recommendations: z.array(z.object({
1771
1929
  name: z.string().min(1).describe("Recommendation developer name"),
1772
1930
  label: z.string().min(1).describe("Label shown to users"),
@@ -1813,8 +1971,8 @@ export const FreezeUserSchema = z.object({
1813
1971
  export const CreateETMTerritorySchema = z.object({
1814
1972
  territoryName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Territory API name"),
1815
1973
  label: z.string().min(1).describe("Territory display label"),
1816
- territoryType: z.string().min(1).describe("Territory2Type API name (must exist in org)"),
1817
- parentTerritoryName: z.string().optional().describe("Parent territory name for hierarchy"),
1974
+ territoryType: z.string().optional().describe("Territory2Type API name (must exist in org)"),
1975
+ parentTerritoryName: z.union([z.string(), z.null()]).optional().describe("Parent territory name for hierarchy"),
1818
1976
  accountAccessLevel: z.enum(["View","Edit","All","None"]).default("View").describe("Account access for territory members"),
1819
1977
  opportunityAccessLevel: z.enum(["View","Edit","All","None"]).default("View").describe("Opportunity access"),
1820
1978
  caseAccessLevel: z.enum(["View","Edit","All","None"]).default("View").describe("Case access"),
@@ -1826,7 +1984,8 @@ export const AssignTerritoryToUserSchema = z.object({
1826
1984
  roleInTerritory: z.enum(["Salesperson","AccountManager","Owner"]).default("Salesperson").describe("User role within the territory"),
1827
1985
  }).strict();
1828
1986
  export const CreateForecastHierarchySchema = z.object({
1829
- forecastingType: z.enum(["OpportunityRevenue","OpportunityQuantity","OverlayRevenue","OverlayQuantity","ProductFamily"]).describe("Forecasting type"),
1987
+ forecastingType: z.enum(["OpportunityRevenue","OpportunityQuantity","OverlayRevenue","OverlayQuantity","ProductFamily"]).default("OpportunityRevenue").describe("Forecasting type"),
1988
+ roleName: z.string().optional().describe("Role name (informational)"),
1830
1989
  displayCurrency: z.string().default("USD").describe("Currency code for display (e.g. 'USD', 'EUR')"),
1831
1990
  isActive: z.boolean().default(true).describe("Enable this forecasting type"),
1832
1991
  }).strict();
@@ -1840,17 +1999,23 @@ export const DeleteCustomFieldSchema = z.object({
1840
1999
  confirmDelete: z.boolean().describe("Must be true to confirm deletion — this is permanent"),
1841
2000
  }).strict();
1842
2001
  export const CreateRollupSummaryFieldSchema = z.object({
1843
- objectApiName: z.string().min(1).describe("Master object API name to add the rollup field to"),
2002
+ objectApiName: z.string().optional().describe("Master object API name to add the rollup field to"),
2003
+ objectName: z.string().optional().describe("Alias for objectApiName"),
1844
2004
  fieldName: z.string().min(1).max(40).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Field API name (without __c)"),
1845
2005
  label: z.string().min(1).describe("Field display label"),
1846
2006
  summaryObject: z.string().min(1).describe("Child (detail) object API name, e.g. 'Opportunity'"),
1847
- summaryType: z.enum(["COUNT","SUM","MIN","MAX"]).describe("Aggregation type"),
2007
+ summaryType: z.enum(["COUNT","SUM","MIN","MAX"]).optional().describe("Aggregation type"),
2008
+ summaryOperation: z.enum(["COUNT","SUM","MIN","MAX"]).optional().describe("Alias for summaryType"),
2009
+ relationshipField: z.string().optional().describe("Relationship field on child object"),
1848
2010
  aggregatedField: z.string().optional().describe("Child field to aggregate (required for SUM/MIN/MAX, e.g. 'Amount')"),
1849
- filterCriteria: z.array(z.object({
1850
- field: z.string().describe("Child field API name"),
1851
- operator: z.enum(["equals","notEqual","lessThan","greaterThan","lessOrEqual","greaterOrEqual","contains","notContain","startsWith"]).describe("Filter operator"),
1852
- value: z.string().describe("Filter value"),
1853
- })).optional().describe("Filter criteria to limit which child records are included"),
2011
+ filterCriteria: z.union([
2012
+ z.string(),
2013
+ z.array(z.object({
2014
+ field: z.string().describe("Child field API name"),
2015
+ operator: z.enum(["equals","notEqual","lessThan","greaterThan","lessOrEqual","greaterOrEqual","contains","notContain","startsWith"]).describe("Filter operator"),
2016
+ value: z.string().describe("Filter value"),
2017
+ })),
2018
+ ]).optional().describe("Filter criteria: string SOQL-like expression or array of {field,operator,value} objects"),
1854
2019
  description: z.string().optional().describe("Field description"),
1855
2020
  }).strict();
1856
2021
  export const CreateExternalIdFieldSchema = z.object({
@@ -1884,17 +2049,21 @@ export const UpdateFlowSchema = z.object({
1884
2049
  objectType: z.string().optional().describe("SObject API name (for SObject dataType)"),
1885
2050
  defaultValue: z.string().optional().describe("Default value expression"),
1886
2051
  })).optional().describe("Variables to add to the flow"),
2052
+ label: z.string().optional().describe("Alias for newLabel"),
2053
+ description: z.string().optional().describe("Alias for newDescription"),
1887
2054
  }).strict();
1888
2055
  export const CloneFlowSchema = z.object({
1889
- sourceFlowApiName: z.string().min(1).describe("Source flow API name to clone"),
1890
- newFlowApiName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("New flow API name"),
1891
- newLabel: z.string().min(1).describe("New flow display label"),
2056
+ sourceFlowApiName: z.string().optional().describe("Source flow API name to clone"),
2057
+ sourceFlowName: z.string().optional().describe("Alias for sourceFlowApiName"),
2058
+ newFlowApiName: z.string().optional().describe("New flow API name"),
2059
+ newFlowName: z.string().optional().describe("Alias for newFlowApiName"),
2060
+ newLabel: z.string().optional().describe("New flow display label"),
1892
2061
  activateImmediately: z.boolean().default(false).describe("Activate the cloned flow immediately"),
1893
2062
  }).strict();
1894
2063
  export const CreateFlowTestSchema = z.object({
1895
2064
  flowApiName: z.string().min(1).describe("Flow API name to test"),
1896
2065
  testName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Test definition API name"),
1897
- label: z.string().min(1).describe("Test display label"),
2066
+ label: z.string().optional().describe("Test display label"),
1898
2067
  description: z.string().optional().describe("Test description"),
1899
2068
  inputs: z.array(z.object({
1900
2069
  name: z.string().describe("Variable name"),
@@ -1923,12 +2092,22 @@ export const CreateInvocableActionSchema = z.object({
1923
2092
  dataType: z.enum(["String","Integer","Long","Double","Boolean","Date","Datetime","Id","sObject"]).describe("Data type"),
1924
2093
  sObjectType: z.string().optional().describe("SObject API name if dataType=sObject"),
1925
2094
  })).default([]).describe("Output parameters"),
2095
+ className: z.string().optional().describe("Apex class name (informational)"),
2096
+ method: z.string().optional().describe("Method name (informational)"),
1926
2097
  }).strict();
1927
2098
  export const SearchApexSchema = z.object({
1928
2099
  searchTerm: z.string().min(1).describe("Text to search for in Apex code"),
1929
- searchIn: z.enum(["Classes","Triggers","Both"]).default("Both").describe("Where to search"),
2100
+ searchIn: z.preprocess(
2101
+ (v) => {
2102
+ if (typeof v !== 'string') return v;
2103
+ const map = { classes: 'Classes', triggers: 'Triggers', both: 'Both', body: 'Both', all: 'Both' };
2104
+ return map[v.toLowerCase()] ?? v;
2105
+ },
2106
+ z.enum(["Classes","Triggers","Both"]).default("Both")
2107
+ ).describe("Where to search: 'Classes', 'Triggers', or 'Both' (also accepts lowercase)"),
1930
2108
  caseSensitive: z.boolean().default(false).describe("Case-sensitive search"),
1931
2109
  limit: z.number().int().default(50).describe("Maximum number of results"),
2110
+ searchType: z.string().optional().describe("Alias for searchIn: class/classes/trigger/triggers/both"),
1932
2111
  }).strict();
1933
2112
  export const GetApexLogsSchema = z.object({
1934
2113
  username: z.string().optional().describe("Filter logs by Salesforce username"),
@@ -1940,7 +2119,9 @@ export const GetApexLogBodySchema = z.object({
1940
2119
  }).strict();
1941
2120
  export const CreateApexBatchSchema = z.object({
1942
2121
  className: z.string().min(1).max(40).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Apex batch class name"),
1943
- sObjectType: z.string().min(1).describe("SObject type to query and process, e.g. 'Account'"),
2122
+ sObjectType: z.string().optional().describe("SObject type to query and process, e.g. 'Account'"),
2123
+ objectApiName: z.string().optional().describe("Alias for sObjectType"),
2124
+ queryFields: z.array(z.string()).optional().describe("Fields to include in query"),
1944
2125
  queryFilter: z.string().optional().describe("SOQL WHERE clause for start method, e.g. \"CreatedDate = TODAY\""),
1945
2126
  batchSize: z.number().int().default(200).describe("Batch size (records per execute call, 1-2000)"),
1946
2127
  description: z.string().optional().describe("Class description / what the batch does"),
@@ -1949,7 +2130,8 @@ export const CreateApexBatchSchema = z.object({
1949
2130
  }).strict();
1950
2131
  export const CreateApexSchedulerSchema = z.object({
1951
2132
  className: z.string().min(1).max(40).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Apex schedulable class name"),
1952
- jobName: z.string().min(1).describe("Default schedule job name"),
2133
+ jobName: z.string().optional().describe("Default schedule job name"),
2134
+ batchClass: z.string().optional().describe("Batch class to schedule (alias for batchClassName)"),
1953
2135
  cronExpression: z.string().default("0 0 2 * * ?").describe("Default cron expression, e.g. '0 0 2 * * ?' (daily at 2am)"),
1954
2136
  batchClassName: z.string().optional().describe("Batch class to execute (if this scheduler runs a batch)"),
1955
2137
  description: z.string().optional().describe("Class description"),
@@ -1980,9 +2162,13 @@ export const RefreshSandboxSchema = z.object({
1980
2162
  apexClassId: z.string().optional().describe("Apex class ID to run after refresh (post-copy script)"),
1981
2163
  }).strict();
1982
2164
  export const ExportPackageXmlSchema = z.object({
1983
- metadataTypes: z.array(z.string()).default([]).describe("Metadata types to include. Empty array = all common types (ApexClass, CustomObject, Flow, PermissionSet, etc.)"),
2165
+ metadataTypes: z.preprocess(
2166
+ (v) => Array.isArray(v) ? v.map(item => typeof item === 'object' && item !== null ? (item.type || item.name || String(item)) : item) : v,
2167
+ z.array(z.string()).default([])
2168
+ ).describe("Metadata types to include: strings or {type, name} objects. Empty = all common types."),
1984
2169
  includeManaged: z.boolean().default(false).describe("Include managed package components"),
1985
2170
  apiVersion: z.string().optional().describe("API version for the package.xml (defaults to current API_VERSION)"),
2171
+ components: z.any().optional().describe("Alias: array of {type, members} objects"),
1986
2172
  }).strict();
1987
2173
  export const CreateExperienceContainerSchema = z.object({
1988
2174
  pageName: z.string().min(1).describe("FlexiPage API name to add the container to"),
@@ -2001,15 +2187,26 @@ export const SetExperienceSiteLoginSchema = z.object({
2001
2187
  }).strict();
2002
2188
  export const CreateCmsContentSchema = z.object({
2003
2189
  contentName: z.string().min(1).max(255).describe("CMS content name"),
2004
- contentType: z.enum(["News","Document","Image","custom"]).describe("CMS content type"),
2190
+ contentType: z.preprocess(
2191
+ (v) => typeof v === 'string' ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v,
2192
+ z.enum(["News","Document","Image","Custom","custom"])
2193
+ ).describe("CMS content type: 'News', 'Document', 'Image', or 'custom' (case-insensitive)"),
2005
2194
  language: z.string().default("en_US").describe("Content language locale, e.g. 'en_US'"),
2006
- fields: z.record(z.string()).describe("Content field key-value pairs, e.g. {title: 'My Title', body: 'Content...'}"),
2195
+ fields: z.union([
2196
+ z.record(z.string()),
2197
+ z.array(z.object({ name: z.string(), value: z.string() })).transform(
2198
+ arr => Object.fromEntries(arr.map(f => [f.name, f.value]))
2199
+ ),
2200
+ ]).describe("Content field key-value pairs, e.g. {title: 'My Title', body: 'Content...'}"),
2007
2201
  channelNames: z.array(z.string()).optional().describe("Experience Cloud site names to publish content to"),
2202
+ title: z.string().optional().describe("Content title (mapped to fields.title)"),
2203
+ body: z.string().optional().describe("Content body (mapped to fields.body)"),
2008
2204
  }).strict();
2009
2205
  export const ExportRecordsSchema = z.object({
2010
2206
  query: z.string().min(1).describe("Full SOQL query string"),
2011
2207
  includeHeaders: z.boolean().default(true).describe("Include CSV header row"),
2012
2208
  limit: z.number().int().default(2000).describe("Maximum records to export"),
2209
+ format: z.string().optional().describe("Export format: json or csv"),
2013
2210
  }).strict();
2014
2211
  export const UpsertRecordSchema = z.object({
2015
2212
  objectApiName: z.string().min(1).describe("SObject API name, e.g. 'Account'"),
@@ -2019,36 +2216,48 @@ export const UpsertRecordSchema = z.object({
2019
2216
  }).strict();
2020
2217
  export const GetRecordSchema = z.object({
2021
2218
  objectApiName: z.string().min(1).describe("SObject API name, e.g. 'Account'"),
2022
- recordId: z.string().min(15).max(18).describe("Record ID"),
2219
+ recordId: z.string().min(15).describe("Record ID (15 or 18 characters)"),
2023
2220
  fields: z.array(z.string()).optional().describe("Field API names to retrieve. Empty = all available fields"),
2024
2221
  }).strict();
2025
2222
  export const SearchRecordsSchema = z.object({
2026
2223
  searchTerm: z.string().min(1).describe("Search term (SOSL FIND clause value, no quotes needed)"),
2027
- objects: z.array(z.object({
2028
- objectName: z.string().describe("SObject API name"),
2029
- fields: z.array(z.string()).describe("Fields to return"),
2030
- })).default([{ objectName: "Account", fields: ["Id","Name"] }, { objectName: "Contact", fields: ["Id","Name","Email"] }]).describe("Objects to search across"),
2224
+ objectTypes: z.array(z.string()).optional().describe("Alias for objects: array of object API name strings"),
2225
+ objects: z.preprocess(
2226
+ (v) => Array.isArray(v) ? v.map(item => typeof item === 'string' ? { objectName: item, fields: ["Id","Name"] } : item) : v,
2227
+ z.array(z.object({
2228
+ objectName: z.string().describe("SObject API name"),
2229
+ fields: z.array(z.string()).describe("Fields to return"),
2230
+ })).default([{ objectName: "Account", fields: ["Id","Name"] }, { objectName: "Contact", fields: ["Id","Name","Email"] }])
2231
+ ).describe("Objects to search across: strings or {objectName, fields} objects"),
2031
2232
  limit: z.number().int().default(20).describe("Maximum results per object"),
2032
2233
  }).strict();
2033
2234
  export const CreatePlatformEventSubscriptionSchema = z.object({
2034
- eventApiName: z.string().min(1).describe("Platform event API name, e.g. 'My_Event__e'"),
2035
- subscriptionType: z.enum(["Trigger","Flow"]).describe("Subscribe via Apex trigger or Flow"),
2036
- subscriberName: z.string().min(1).describe("API name of the trigger or flow to create/reference"),
2235
+ eventApiName: z.string().optional().describe("Platform event API name, e.g. 'My_Event__e'"),
2236
+ platformEventName: z.string().optional().describe("Alias for eventApiName"),
2237
+ subscriptionType: z.enum(["Trigger","Flow"]).default("Flow").describe("Subscribe via Apex trigger or Flow"),
2238
+ subscriberName: z.string().optional().describe("API name of the trigger or flow to create/reference"),
2239
+ subscriberFlowName: z.string().optional().describe("Alias for subscriberName"),
2240
+ description: z.string().optional().describe("Description"),
2037
2241
  apexCode: z.string().optional().describe("Apex trigger body (for Trigger type). Auto-generated if omitted."),
2038
2242
  }).strict();
2039
2243
  export const CreateChangedDataCaptureSchema = z.object({
2040
- objectApiName: z.string().min(1).describe("Object API name to enable CDC for, e.g. 'Account', 'Contact', 'My_Object__c'"),
2244
+ objectApiName: z.string().optional().describe("Object API name to enable CDC for, e.g. 'Account', 'Contact', 'My_Object__c'"),
2245
+ objectName: z.string().optional().describe("Alias for objectApiName"),
2041
2246
  enabled: z.boolean().default(true).describe("Enable or disable CDC for this object"),
2042
2247
  }).strict();
2043
2248
  export const CreateRestResourceSchema = z.object({
2044
- resourceName: z.string().min(1).max(40).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Apex class name for the REST resource"),
2249
+ resourceName: z.string().optional().describe("Apex class name for the REST resource"),
2250
+ className: z.string().optional().describe("Alias for resourceName"),
2045
2251
  urlMapping: z.string().min(1).describe("URL mapping, e.g. '/myresource/*' or '/accounts/:id'"),
2046
2252
  description: z.string().optional().describe("Resource description"),
2047
- methods: z.array(z.object({
2048
- httpMethod: z.enum(["GET","POST","PUT","DELETE","PATCH"]).describe("HTTP method"),
2049
- description: z.string().optional().describe("Method description"),
2050
- apexCode: z.string().optional().describe("Method body code (returns empty implementation if omitted)"),
2051
- })).min(1).describe("HTTP methods to implement"),
2253
+ methods: z.array(z.union([
2254
+ z.string().transform(s => ({ httpMethod: s })),
2255
+ z.object({
2256
+ httpMethod: z.enum(["GET","POST","PUT","DELETE","PATCH"]).describe("HTTP method"),
2257
+ description: z.string().optional().describe("Method description"),
2258
+ apexCode: z.string().optional().describe("Method body code (returns empty implementation if omitted)"),
2259
+ }),
2260
+ ])).min(1).describe("HTTP methods to implement (array of method names or {httpMethod, description?, apexCode?} objects)"),
2052
2261
  }).strict();
2053
2262
  export const GetOrgLimitsSchema = z.object({
2054
2263
  filter: z.string().optional().describe("Optional filter string — return only limits whose name contains this text (e.g. 'Api', 'Storage', 'Scratch')"),
@@ -2062,27 +2271,33 @@ export const GetApexTestResultsSchema = z.object({
2062
2271
  testRunId: z.string().optional().describe("Specific test run ID (from sf_run_apex_tests). Omit to get latest run."),
2063
2272
  className: z.string().optional().describe("Filter to a specific Apex test class"),
2064
2273
  outcomeFilter: z.enum(["Pass","Fail","CompileFail","Skip","all"]).default("all").describe("Filter by outcome"),
2274
+ limit: z.number().int().min(1).max(2000).default(200).optional().describe("Maximum results to return"),
2065
2275
  }).strict();
2066
2276
  export const GetDeploymentHistorySchema = z.object({
2067
2277
  limit: z.number().int().default(10).describe("Maximum deployments to return"),
2068
2278
  status: z.enum(["Succeeded","Failed","Pending","InProgress","Canceling","all"]).default("all").describe("Filter by deployment status"),
2069
2279
  }).strict();
2070
2280
  export const CreateAgentChannelSchema = z.object({
2071
- agentApiName: z.string().min(1).describe("Agentforce agent (Bot) API name"),
2072
- channelType: z.enum(["Messaging","Chat","Embedded","Voice"]).describe("Channel type to configure"),
2281
+ agentApiName: z.string().optional().describe("Agentforce agent (Bot) API name"),
2282
+ agentName: z.string().optional().describe("Alias for agentApiName"),
2283
+ channelType: z.enum(["Messaging","Chat","Embedded","Voice","Web"]).describe("Channel type to configure"),
2073
2284
  channelName: z.string().min(1).describe("Existing channel API name (MessagingChannel for Messaging, LiveChatButton for Chat)"),
2074
2285
  routingType: z.enum(["Queue","Agent","Bot"]).default("Bot").describe("Routing type — Bot routes to agent first, then escalates"),
2075
2286
  queueName: z.string().optional().describe("Queue name for escalation (recommended when routingType=Bot)"),
2287
+ label: z.string().optional().describe("Channel display label"),
2076
2288
  }).strict();
2077
2289
  export const CloneAgentSchema = z.object({
2078
- sourceAgentApiName: z.string().min(1).describe("Source agent (Bot) API name to clone"),
2079
- newAgentApiName: z.string().min(1).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("New agent API name"),
2080
- newLabel: z.string().min(1).describe("New agent display label"),
2290
+ sourceAgentApiName: z.string().optional().describe("Source agent (Bot) API name to clone"),
2291
+ sourceAgentName: z.string().optional().describe("Alias for sourceAgentApiName"),
2292
+ newAgentApiName: z.string().optional().describe("New agent API name"),
2293
+ newAgentName: z.string().optional().describe("Alias for newAgentApiName"),
2294
+ newLabel: z.string().optional().describe("New agent display label"),
2081
2295
  includeTopics: z.boolean().default(true).describe("Clone the agent's topics (GenAiPlugins)"),
2082
2296
  includeActions: z.boolean().default(true).describe("Clone the agent's actions (GenAiFunctions) — requires includeTopics=true"),
2083
2297
  }).strict();
2084
2298
  export const ExportAgentSchema = z.object({
2085
- agentApiName: z.string().min(1).describe("Agent (Bot) API name to export"),
2299
+ agentApiName: z.string().optional().describe("Agent (Bot) API name to export"),
2300
+ agentName: z.string().optional().describe("Alias for agentApiName"),
2086
2301
  }).strict();
2087
2302
  export const ExportOmniStudioComponentSchema = z.object({
2088
2303
  componentType: z.enum(["FlexCard","OmniScript","DataRaptor","IntegrationProcedure"]).describe("Component type to export"),