salesforce-metadata-mcp 2.5.2 → 2.5.4

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.
Files changed (64) hide show
  1. package/AGENTFORCE.md +65 -287
  2. package/CHANGELOG.md +68 -0
  3. package/README.md +19 -250
  4. package/TOOLS.md +103 -2034
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +4 -4
  7. package/dist/index.js.map +1 -1
  8. package/dist/schemas/index.d.ts +3833 -6
  9. package/dist/schemas/index.d.ts.map +1 -1
  10. package/dist/schemas/index.js +286 -241
  11. package/dist/schemas/index.js.map +1 -1
  12. package/dist/services/deployment.d.ts +4 -0
  13. package/dist/services/deployment.d.ts.map +1 -1
  14. package/dist/services/deployment.js +2 -124
  15. package/dist/services/deployment.js.map +1 -1
  16. package/dist/services/salesforce.d.ts +243 -1
  17. package/dist/services/salesforce.d.ts.map +1 -1
  18. package/dist/services/salesforce.js +1511 -857
  19. package/dist/services/salesforce.js.map +1 -1
  20. package/dist/tools/admin.d.ts +3 -0
  21. package/dist/tools/admin.d.ts.map +1 -0
  22. package/dist/tools/admin.js +3 -15
  23. package/dist/tools/admin.js.map +1 -0
  24. package/dist/tools/agentforce.js +43 -303
  25. package/dist/tools/apex.js +3 -154
  26. package/dist/tools/audit.d.ts +3 -0
  27. package/dist/tools/audit.d.ts.map +1 -0
  28. package/dist/tools/audit.js +2 -8
  29. package/dist/tools/audit.js.map +1 -0
  30. package/dist/tools/automation.js +2 -90
  31. package/dist/tools/data.d.ts +3 -0
  32. package/dist/tools/data.d.ts.map +1 -0
  33. package/dist/tools/data.js +1 -4
  34. package/dist/tools/data.js.map +1 -0
  35. package/dist/tools/deployment.js +5 -148
  36. package/dist/tools/deployment.js.map +1 -1
  37. package/dist/tools/einstein.d.ts +3 -0
  38. package/dist/tools/einstein.d.ts.map +1 -0
  39. package/dist/tools/einstein.js +2 -7
  40. package/dist/tools/einstein.js.map +1 -0
  41. package/dist/tools/experience.js +2 -105
  42. package/dist/tools/index.d.ts.map +1 -1
  43. package/dist/tools/index.js.map +1 -1
  44. package/dist/tools/integrations.js +2 -113
  45. package/dist/tools/monitoring.d.ts +3 -0
  46. package/dist/tools/monitoring.d.ts.map +1 -0
  47. package/dist/tools/monitoring.js +4 -12
  48. package/dist/tools/monitoring.js.map +1 -0
  49. package/dist/tools/objects.js +2 -129
  50. package/dist/tools/omnichannel.d.ts +3 -0
  51. package/dist/tools/omnichannel.d.ts.map +1 -0
  52. package/dist/tools/omnichannel.js +3 -28
  53. package/dist/tools/omnichannel.js.map +1 -0
  54. package/dist/tools/omnistudio.d.ts +3 -0
  55. package/dist/tools/omnistudio.d.ts.map +1 -0
  56. package/dist/tools/omnistudio.js +3 -37
  57. package/dist/tools/omnistudio.js.map +1 -0
  58. package/dist/tools/reports.d.ts +3 -0
  59. package/dist/tools/reports.d.ts.map +1 -0
  60. package/dist/tools/reports.js +3 -3
  61. package/dist/tools/reports.js.map +1 -0
  62. package/dist/tools/security.js +2 -82
  63. package/dist/tools/ui.js +2 -102
  64. package/package.json +3 -3
@@ -858,92 +858,37 @@ export const CreateExperiencePageSchema = z.object({
858
858
  }).strict();
859
859
  // ─── AGENTFORCE ───────────────────────────────────────────────────────────────
860
860
  export const CreateAgentSchema = z.object({
861
- 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
- label: z.string().min(1).max(255).describe("Agent display label, e.g. 'CRM Record Creator'"),
863
- 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."),
865
- 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
- openingMessage: z.string().max(2000).optional().describe("Welcome message shown to users when they first open the agent (set as welcomeMessage on the Bot)."),
861
+ agentName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Agent API name, e.g. 'SupportAgent'"),
862
+ label: z.string().min(1).max(255).describe("Agent display name"),
863
+ description: z.string().max(1000).optional().describe("Agent description shown to users"),
864
+ type: z.enum(["Default", "EinsteinCopilot"]).default("EinsteinCopilot").describe("Agent type"),
865
+ company: z.string().max(255).optional().describe("Company name for the agent's context"),
866
+ persona: z.string().max(5000).optional().describe("Agent persona description, e.g. 'A helpful customer service representative'"),
867
+ tone: z.enum(["Formal", "Neutral", "Casual"]).default("Neutral").describe("Communication tone"),
868
+ instructions: z.string().max(10000).optional().describe("System-level instructions for the agent"),
867
869
  }).strict();
868
870
  export const CreateAgentTopicSchema = z.object({
869
- 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."),
870
- label: z.string().min(1).max(255).describe("Topic display label, e.g. 'Create Account Topic'"),
871
- description: z.string().min(1).max(5000).describe("Routing description — the LLM uses this to decide which topic handles a user request. Be specific, e.g. 'Use this topic when the user wants to create, add, or make a new Account or company record'"),
872
- scope: z.string().min(1).max(5000).describe("What this topic covers in detail, e.g. 'Create new Account records with company name, industry, phone, and website'"),
873
- instructions: z.array(z.string().max(2000)).optional().describe("Ordered step-by-step instructions for the agent, e.g. ['Ask the user for the account name', 'Call the Create Account action', 'Confirm success to the user']"),
874
- 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
- escalationEnabled: z.boolean().optional().describe("Whether this topic can escalate to a human agent (sets canEscalate on GenAiPlugin). Default: false."),
876
- fallbackTopic: z.string().max(80).optional().describe("API name of another GenAiPlugin topic to fall back to if this topic cannot handle the request."),
877
- }).strict();
878
- const AgentParamSchema = z.object({
879
- name: z.string().max(80).describe("Parameter API name matching the flow variable name, e.g. 'AccountName'"),
880
- label: z.string().max(255).describe("Human-readable label, e.g. 'Account Name'"),
881
- description: z.string().max(1000).optional().describe("Description shown to the LLM, e.g. 'The name of the company or organization'"),
882
- type: z.enum(["Text", "Number", "Currency", "Boolean", "Date", "DateTime", "TextArea"]).default("Text").describe("Data type — must match the flow variable type: 'Currency'/'Number' for numeric fields, 'Date' for date fields, 'Boolean' for checkboxes, 'Text' for everything else"),
883
- required: z.boolean().default(true).describe("Whether this input is required"),
884
- });
871
+ agentName: z.string().min(1).max(80).describe("Parent agent API name"),
872
+ topicName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Topic API name, e.g. 'OrderManagement'"),
873
+ label: z.string().min(1).max(255).describe("Topic label"),
874
+ description: z.string().min(1).max(5000).describe("What this topic covers"),
875
+ scope: z.string().min(1).max(5000).describe("Scope of this topic — what kind of requests it handles"),
876
+ instructions: z.string().max(10000).optional().describe("Step-by-step instructions for handling this topic"),
877
+ actions: z.array(z.string().max(80)).optional().describe("Action API names to associate with this topic"),
878
+ }).strict();
885
879
  export const CreateAgentActionSchema = z.object({
886
- actionName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Action API name (GenAiFunction developer name), e.g. 'Create_Account'. Used to reference this action from topics."),
887
- label: z.string().min(1).max(255).describe("Action display label, e.g. 'Create Account'"),
888
- description: z.string().min(1).max(5000).describe("What this action does — the LLM uses this to decide when to invoke it. Be specific, e.g. 'Creates a new Account record in Salesforce with the given company name, industry, phone, and website'"),
889
- invocationTargetType: z.enum(["Flow", "ApexClass"]).default("Flow").describe("Type of backend to invoke: 'Flow' for AutoLaunchedFlow (most common), 'ApexClass' for an Apex class implementing InvocableMethod."),
890
- flowApiName: z.string().max(255).optional().describe("API name of the AutoLaunchedFlow to invoke (required when invocationTargetType is Flow). Must be Active with runInMode=SystemModeWithoutSharing."),
891
- 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
- 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
- outputs: z.array(AgentParamSchema.omit({ required: true })).optional().describe("Output parameters returned to the agent after execution, e.g. the created record ID"),
894
- }).strict();
895
- export const CreateAgentPlannerSchema = z.object({
896
- 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."),
897
- label: z.string().min(1).max(255).describe("Planner display label, e.g. 'CRM Creator Planner'"),
898
- description: z.string().max(1000).optional().describe("Planner description"),
899
- topicNames: z.array(z.string().min(1).max(80)).min(1).describe("Topic API names (GenAiPlugin developer names) to include, e.g. ['Create_Account_Topic', 'Create_Lead_Topic']. Topics must already exist."),
900
- 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
- }).strict();
902
- 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'"),
904
- }).strict();
905
- export const DeactivateAgentSchema = z.object({
906
- agentApiName: z.string().min(1).max(80).describe("API name of the agent to deactivate, e.g. 'CRM_Record_Creator'"),
907
- }).strict();
908
- export const GetAgentSchema = z.object({
909
- agentApiName: z.string().min(1).max(80).describe("Agent API name, e.g. 'CRM_Record_Creator'"),
910
- }).strict();
911
- 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."),
913
- 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"),
917
- instructions: z.array(z.string().max(2000)).optional().describe("Updated step-by-step instructions (replaces existing)"),
918
- actions: z.array(z.string().max(80)).optional().describe("Updated action API names (replaces existing)"),
919
- escalationEnabled: z.boolean().optional().describe("Whether this topic can escalate to a human agent"),
920
- fallbackTopic: z.string().max(80).optional().describe("API name of fallback topic"),
921
- }).strict();
922
- export const UpdateAgentActionSchema = z.object({
923
- actionName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Action API name to update (GenAiFunction developer name)"),
924
- label: z.string().min(1).max(255).describe("Updated action display label"),
925
- description: z.string().min(1).max(5000).describe("Updated action description"),
926
- invocationTargetType: z.enum(["Flow", "ApexClass"]).default("Flow").describe("Type of backend to invoke"),
927
- flowApiName: z.string().max(255).optional().describe("API name of the AutoLaunchedFlow (required if invocationTargetType is Flow)"),
928
- apexClassName: z.string().max(255).optional().describe("API name of the Apex class (required if invocationTargetType is ApexClass)"),
929
- inputs: z.array(AgentParamSchema).optional().describe("Updated input parameters (replaces existing)"),
930
- outputs: z.array(AgentParamSchema.omit({ required: true })).optional().describe("Updated output parameters (replaces existing)"),
931
- }).strict();
932
- export const DeleteAgentSchema = z.object({
933
- agentApiName: z.string().min(1).max(80).describe("API name of the agent to delete, e.g. 'CRM_Record_Creator'"),
934
- deleteTopics: z.boolean().default(false).describe("If true, also deletes the agent's GenAiPlugin topics (identified via its GenAiPlannerBundle)"),
935
- deleteActions: z.boolean().default(false).describe("If true, also deletes the GenAiFunction actions referenced by the agent's topics"),
936
- }).strict();
937
- export const ListAgentsSchema = z.object({}).strict();
938
- 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'"),
941
- 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
- }).strict();
943
- export const GetAgentLogsSchema = z.object({
944
- agentApiName: z.string().max(80).optional().describe("Filter logs by agent API name (optional — omit to see all agent activity in the org)"),
945
- limit: z.number().int().min(1).max(200).default(20).describe("Maximum number of log entries to return (default: 20)"),
946
- hoursBack: z.number().min(0.1).max(24).default(1).describe("How many hours back to look (default: 1 hour)"),
880
+ agentName: z.string().min(1).max(80).describe("Parent agent API name"),
881
+ topicName: z.string().min(1).max(80).describe("Parent topic API name"),
882
+ actionName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Action API name"),
883
+ label: z.string().min(1).max(255).describe("Action label"),
884
+ description: z.string().min(1).max(5000).describe("What this action does"),
885
+ type: z.enum(["Flow", "ApexClass", "PromptTemplate", "DataCategoryGroup", "ExternalService"])
886
+ .describe("Action type"),
887
+ reference: z.string().min(1).max(255).describe("API name of the Flow, Apex class, or Prompt Template to invoke"),
888
+ inputs: z.array(z.object({
889
+ name: z.string().max(255).describe("Input parameter name"),
890
+ value: z.string().max(1000).describe("Value or reference, e.g. '{!Agent.Topic.Entities.accountName}'"),
891
+ })).optional().describe("Input parameter mappings"),
947
892
  }).strict();
948
893
  // ─── MCP SERVER MANAGEMENT ───────────────────────────────────────────────────
949
894
  export const CreateMcpServerSchema = z.object({
@@ -1038,18 +983,21 @@ export const DeployMetadataSchema = z.object({
1038
983
  runTests: z.array(z.string()).optional().describe("Test classes to run during deployment"),
1039
984
  rollbackOnError: z.boolean().default(true).describe("Roll back all changes if any component fails"),
1040
985
  waitMinutes: z.number().int().min(1).max(60).default(10).describe("Max minutes to wait for deploy to complete"),
1041
- testLevel: z.enum(["NoTestRun","RunSpecifiedTests","RunLocalTests","RunAllTestsInOrg"]).optional().describe("Test level: NoTestRun, RunSpecifiedTests, RunLocalTests, or RunAllTestsInOrg"),
986
+ testLevel: z.enum(["NoTestRun", "RunSpecifiedTests", "RunLocalTests", "RunAllTestsInOrg"]).optional().describe("Test level: NoTestRun, RunSpecifiedTests, RunLocalTests, or RunAllTestsInOrg"),
1042
987
  }).strict();
1043
988
  export const CheckDeployStatusSchema = z.object({
1044
989
  deployId: z.string().min(1).describe("Deploy async job ID returned from sf_deploy_metadata"),
1045
990
  }).strict();
1046
991
  export const RetrieveMetadataSchema = z.object({
1047
- components: z.array(ComponentRefSchema).min(1).describe("Metadata components to retrieve"),
992
+ components: z.array(ComponentRefSchema).optional().describe("Metadata components to retrieve"),
993
+ metadataType: z.string().optional().describe("Single metadata type (alternative to components array)"),
994
+ componentName: z.string().optional().describe("Single component name (used with metadataType)"),
1048
995
  packageXml: z.string().optional().describe("Raw package.xml content for selective retrieve. If provided, components list is ignored."),
1049
996
  }).strict();
1050
997
  // ─── OBJECTS & FIELDS (v2.2.0) ───────────────────────────────────────────────
1051
998
  export const UpdateCustomObjectSchema = z.object({
1052
- objectApiName: z.string().min(1).describe("Custom object API name, e.g. 'MyObject__c'"),
999
+ objectApiName: z.string().optional().describe("Custom object API name, e.g. 'MyObject__c'"),
1000
+ fullName: z.string().optional().describe("Alias for objectApiName"),
1053
1001
  label: z.string().optional().describe("New singular label"),
1054
1002
  pluralLabel: z.string().optional().describe("New plural label"),
1055
1003
  description: z.string().optional().describe("New description"),
@@ -1059,8 +1007,10 @@ export const UpdateCustomObjectSchema = z.object({
1059
1007
  enableActivities: z.boolean().optional().describe("Enable activities (tasks and events)"),
1060
1008
  }).strict();
1061
1009
  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'"),
1010
+ objectApiName: z.string().optional().describe("Object API name, e.g. 'Account'"),
1011
+ objectName: z.string().optional().describe("Alias for objectApiName"),
1012
+ fieldApiName: z.string().optional().describe("Field API name, e.g. 'MyField__c'"),
1013
+ fieldName: z.string().optional().describe("Alias for fieldApiName"),
1064
1014
  label: z.string().optional().describe("New field label"),
1065
1015
  description: z.string().optional().describe("New description"),
1066
1016
  helpText: z.string().optional().describe("New inline help text"),
@@ -1069,13 +1019,16 @@ export const UpdateCustomFieldSchema = z.object({
1069
1019
  defaultValue: z.string().optional().describe("New default value"),
1070
1020
  }).strict();
1071
1021
  export const CreateRelationshipFieldSchema = z.object({
1072
- objectApiName: z.string().min(1).describe("Object API name to create the field on, e.g. 'Contact'"),
1022
+ objectApiName: z.string().optional().describe("Object API name to create the field on, e.g. 'Contact'"),
1023
+ objectName: z.string().optional().describe("Alias for objectApiName"),
1073
1024
  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
1025
  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'"),
1026
+ relationshipType: z.enum(["Lookup", "MasterDetail"]).optional().describe("Lookup: optional reference field. MasterDetail: required parent-child relationship (child deleted with parent)."),
1027
+ relationType: z.enum(["Lookup", "MasterDetail"]).optional().describe("Alias for relationshipType"),
1028
+ relatedObject: z.string().optional().describe("API name of the related (parent) object, e.g. 'Account'"),
1029
+ referenceTo: z.string().optional().describe("Alias for relatedObject"),
1077
1030
  relationshipName: z.string().min(1).describe("Relationship API name used in SOQL, e.g. 'Account' (no spaces or double underscores)"),
1078
- 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)"),
1031
+ 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
1032
  required: z.boolean().default(false).describe("Make field required (Lookup only; MasterDetail is always required)"),
1080
1033
  description: z.string().optional().describe("Field description"),
1081
1034
  }).strict();
@@ -1083,7 +1036,7 @@ export const CreateFormulaFieldSchema = z.object({
1083
1036
  objectApiName: z.string().min(1).describe("Object API name, e.g. 'Opportunity'"),
1084
1037
  fieldName: z.string().min(1).max(40).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Field name without __c suffix"),
1085
1038
  label: z.string().min(1).describe("Field label"),
1086
- returnType: z.enum(["Text","Number","Currency","Date","DateTime","Checkbox","Percent"]).describe("Formula return type"),
1039
+ returnType: z.enum(["Text", "Number", "Currency", "Date", "DateTime", "Checkbox", "Percent"]).describe("Formula return type"),
1087
1040
  formula: z.string().min(1).describe("Salesforce formula expression, e.g. 'MONTH(TODAY())' or 'Price__c * Quantity__c'"),
1088
1041
  scale: z.number().int().min(0).max(18).optional().describe("Decimal places for Number/Currency/Percent return types"),
1089
1042
  description: z.string().optional().describe("Field description"),
@@ -1101,7 +1054,7 @@ export const CreatePermissionSetGroupSchema = z.object({
1101
1054
  permissionSets: z.array(z.string().min(1)).min(1).describe("Array of Permission Set API names to include in this group"),
1102
1055
  }).strict();
1103
1056
  const ObjPermSchema = z.object({
1104
- object: z.string().min(1).describe("Object API name, e.g. 'Account'"),
1057
+ object: z.string().optional().describe("Object API name, e.g. 'Account'"),
1105
1058
  read: z.boolean().default(false),
1106
1059
  create: z.boolean().default(false),
1107
1060
  edit: z.boolean().default(false),
@@ -1120,31 +1073,46 @@ export const UpdatePermissionSetSchema = z.object({
1120
1073
  fieldPermissions: z.array(FldPermSchema).optional().describe("Field-level security to set. Replaces existing FLS for specified fields."),
1121
1074
  }).strict();
1122
1075
  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"),
1076
+ mutingPermSetName: z.string().optional().describe("Muting Permission Set API name"),
1077
+ permissionSetName: z.string().optional().describe("Alias for mutingPermSetName"),
1078
+ description: z.string().optional().describe("Description"),
1124
1079
  label: z.string().min(1).describe("Display label"),
1125
1080
  permissionSetGroup: z.string().optional().describe("Permission Set Group API name to add this muting perm set to"),
1126
1081
  objectPermissions: z.array(ObjPermSchema).optional().describe("Object permissions to mute (suppress)"),
1127
1082
  fieldPermissions: z.array(FldPermSchema).optional().describe("Field permissions to mute"),
1128
1083
  }).strict();
1129
1084
  export const SetFieldLevelSecuritySchema = z.object({
1130
- fieldApiName: z.string().min(1).describe("Field in Object.Field format, e.g. 'Account.AnnualRevenue'"),
1085
+ fieldApiName: z.string().optional().describe("Field in Object.Field format, e.g. 'Account.AnnualRevenue'"),
1086
+ permissionSetName: z.string().optional().describe("Single permission set name"),
1087
+ objectName: z.string().optional().describe("Object API name (informational)"),
1088
+ fields: z.array(z.object({
1089
+ field: z.string().describe("Field API name"),
1090
+ readable: z.boolean().optional(),
1091
+ editable: z.boolean().optional(),
1092
+ })).optional().describe("Array of field FLS settings"),
1131
1093
  profiles: z.array(z.string()).optional().describe("Profile API names to update FLS for"),
1132
1094
  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)"),
1095
+ readable: z.boolean().optional().describe("Grant read access to this field"),
1096
+ editable: z.boolean().optional().describe("Grant edit access to this field (read is implied if editable)"),
1135
1097
  }).strict();
1136
1098
  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"),
1139
- defaultExternal: z.enum(["Private","PublicRead","PublicReadWrite","ControlledByParent"]).optional().describe("External org-wide default (for orgs with external sharing model enabled)"),
1099
+ objectApiName: z.string().optional().describe("Object API name, e.g. 'Opportunity__c'. For standard objects like Account, use the object API name."),
1100
+ objectName: z.string().optional().describe("Alias for objectApiName"),
1101
+ defaultInternal: z.enum(["Private", "PublicRead", "PublicReadWrite", "ControlledByParent"]).optional().describe("Internal org-wide default sharing model"),
1102
+ defaultAccess: z.string().optional().describe("Alias for defaultInternal: Private, PublicRead, PublicReadWrite"),
1103
+ externalAccess: z.string().optional().describe("External org-wide default sharing"),
1104
+ defaultExternal: z.enum(["Private", "PublicRead", "PublicReadWrite", "ControlledByParent"]).optional().describe("External org-wide default (for orgs with external sharing model enabled)"),
1140
1105
  }).strict();
1141
1106
  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'"),
1107
+ profileName: z.string().optional().describe("New profile API name"),
1108
+ newProfileName: z.string().optional().describe("Alias for profileName"),
1109
+ label: z.string().optional().describe("New profile display label"),
1110
+ cloneFrom: z.string().optional().describe("API name of existing profile to clone, e.g. 'Standard User'"),
1111
+ sourceProfileName: z.string().optional().describe("Alias for cloneFrom"),
1112
+ description: z.string().optional().describe("Profile description"),
1145
1113
  }).strict();
1146
1114
  const ProfileObjPermSchema = z.object({
1147
- object: z.string().min(1).describe("Object API name"),
1115
+ object: z.string().optional().describe("Object API name"),
1148
1116
  allowCreate: z.boolean().default(false),
1149
1117
  allowDelete: z.boolean().default(false),
1150
1118
  allowEdit: z.boolean().default(false),
@@ -1156,22 +1124,29 @@ export const UpdateProfileSchema = z.object({
1156
1124
  profileName: z.string().min(1).describe("Profile API name to update"),
1157
1125
  objectPermissions: z.array(ProfileObjPermSchema).optional().describe("Object permissions to set"),
1158
1126
  fieldPermissions: z.array(FldPermSchema).optional().describe("Field-level security to set"),
1159
- tabVisibilities: z.array(z.object({ tab: z.string(), visibility: z.enum(["DefaultOn","DefaultOff","Hidden"]) })).optional().describe("Tab visibility settings"),
1127
+ tabVisibilities: z.array(z.object({ tab: z.string(), visibility: z.enum(["DefaultOn", "DefaultOff", "Hidden"]) })).optional().describe("Tab visibility settings"),
1160
1128
  applicationVisibilities: z.array(z.object({ application: z.string(), visible: z.boolean(), default: z.boolean().default(false) })).optional().describe("App visibility settings"),
1161
1129
  }).strict();
1162
1130
  // ─── PAGE LAYOUTS & UI (v2.2.0) ──────────────────────────────────────────────
1163
1131
  export const UpdatePageLayoutSchema = z.object({
1164
1132
  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"),
1133
+ fieldsToAdd: z.array(z.union([
1134
+ z.string().transform((s) => ({ field: s })),
1135
+ z.object({ field: z.string(), section: z.string().optional(), column: z.number().int().min(0).max(1).default(0) }),
1136
+ ])).optional().describe("Fields to add: field API name strings or {field, section?, column?} objects"),
1166
1137
  fieldsToRemove: z.array(z.string()).optional().describe("Field API names to remove from the layout"),
1167
1138
  relatedListsToAdd: z.array(z.string()).optional().describe("Related list API names to add, e.g. 'Contacts'"),
1168
1139
  relatedListsToRemove: z.array(z.string()).optional().describe("Related list API names to remove"),
1169
1140
  buttonsToAdd: z.array(z.string()).optional().describe("Custom button names to add to the layout"),
1141
+ objectName: z.string().optional().describe("Object API name (informational)"),
1142
+ sections: z.array(z.any()).optional().describe("Page layout sections"),
1170
1143
  }).strict();
1171
1144
  export const AssignPageLayoutSchema = z.object({
1172
- objectApiName: z.string().min(1).describe("Object API name, e.g. 'Account'"),
1145
+ objectApiName: z.string().optional().describe("Object API name, e.g. 'Account'"),
1146
+ objectName: z.string().optional().describe("Alias for objectApiName"),
1173
1147
  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"),
1148
+ profileName: z.string().optional().describe("Profile API name to assign the layout to"),
1149
+ profiles: z.array(z.string()).optional().describe("Array of profile names (alternative to profileName)"),
1175
1150
  recordTypeName: z.string().optional().describe("Record type developer name (if assigning to a specific record type)"),
1176
1151
  }).strict();
1177
1152
  const FlexiComponentSchema = z.object({
@@ -1184,7 +1159,7 @@ export const CreateLightningRecordPageSchema = z.object({
1184
1159
  pageName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("FlexiPage API name"),
1185
1160
  label: z.string().min(1).describe("Page display label"),
1186
1161
  objectApiName: z.string().min(1).describe("Object API name for the record page"),
1187
- template: z.enum(["HeaderAndRightSidebar","HeaderAndThreeRegions","MosaicTemplate","FullWidth","LeftSidebar"]).default("HeaderAndRightSidebar").describe("Page template"),
1162
+ template: z.enum(["HeaderAndRightSidebar", "HeaderAndThreeRegions", "MosaicTemplate", "FullWidth", "LeftSidebar"]).default("HeaderAndRightSidebar").describe("Page template"),
1188
1163
  components: z.array(FlexiComponentSchema).optional().describe("Components to add to the page"),
1189
1164
  }).strict();
1190
1165
  export const CreateLightningHomePageSchema = z.object({
@@ -1200,30 +1175,33 @@ export const UpdateLightningPageSchema = z.object({
1200
1175
  }).strict();
1201
1176
  export const AssignLightningPageSchema = z.object({
1202
1177
  pageApiName: z.string().min(1).describe("FlexiPage API name to assign"),
1203
- assignmentType: z.enum(["org","app","recordType"]).describe("Assignment scope"),
1178
+ assignmentType: z.enum(["org", "app", "recordType"]).describe("Assignment scope"),
1204
1179
  appName: z.string().optional().describe("Lightning App API name (required for app assignment)"),
1205
1180
  recordTypeName: z.string().optional().describe("Record Type developer name (for recordType assignment)"),
1206
1181
  objectApiName: z.string().optional().describe("Object API name (for record page assignments)"),
1207
1182
  }).strict();
1208
1183
  export const AssignCompactLayoutSchema = z.object({
1209
- objectApiName: z.string().min(1).describe("Object API name, e.g. 'Account'"),
1184
+ objectApiName: z.string().optional().describe("Object API name, e.g. 'Account'"),
1185
+ objectName: z.string().optional().describe("Alias for objectApiName"),
1210
1186
  compactLayoutName: z.string().min(1).describe("Compact layout API name to assign as default"),
1211
1187
  recordTypeName: z.string().optional().describe("Record type developer name (if assigning to a specific record type)"),
1212
1188
  }).strict();
1213
1189
  // ─── AUTOMATION (v2.2.0) ─────────────────────────────────────────────────────
1214
1190
  export const ActivateFlowSchema = z.object({
1215
1191
  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"),
1192
+ action: z.enum(["activate", "deactivate"]).default("activate").describe("Whether to activate or deactivate the flow"),
1217
1193
  versionNumber: z.number().int().optional().describe("Specific version number to activate. Defaults to latest version."),
1218
1194
  }).strict();
1219
1195
  export const CreateQuickActionSchema = z.object({
1220
1196
  actionName: z.string().min(1).describe("Full API name. For object-specific: 'Object.ActionName'. For global: 'ActionName'."),
1221
1197
  label: z.string().min(1).describe("Action display label"),
1222
- actionType: z.enum(["Create","Update","LogACall","CustomVF","LightningComponent"]).describe("Action type"),
1198
+ actionType: z.enum(["Create", "Update", "LogACall", "CustomVF", "LightningComponent"]).describe("Action type"),
1223
1199
  targetObject: z.string().optional().describe("Target object API name for Create/Update actions, e.g. 'Contact'"),
1224
1200
  targetFields: z.array(z.object({ field: z.string(), value: z.string() })).optional().describe("Pre-populated field values"),
1225
- standardLabel: z.enum(["None","New","NewEvent","NewTask","LogACall","SendEmail","NewCase","NewOpportunity","NewContact","NewLead","NewNote","NewAccount","ScreenPop"]).optional().describe("Standard action label type"),
1201
+ standardLabel: z.enum(["None", "New", "NewEvent", "NewTask", "LogACall", "SendEmail", "NewCase", "NewOpportunity", "NewContact", "NewLead", "NewNote", "NewAccount", "ScreenPop"]).optional().describe("Standard action label type"),
1226
1202
  description: z.string().optional().describe("Action description"),
1203
+ objectName: z.string().optional().describe("Object API name (informational prefix)"),
1204
+ fields: z.array(z.any()).optional().describe("Alias for targetFields"),
1227
1205
  }).strict();
1228
1206
  // ─── APEX & LWC (v2.2.0) ─────────────────────────────────────────────────────
1229
1207
  export const UpdateApexClassSchema = z.object({
@@ -1240,7 +1218,8 @@ export const GetCodeCoverageSchema = z.object({
1240
1218
  export const CreateVisualforcePageSchema = z.object({
1241
1219
  pageName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Visualforce page API name"),
1242
1220
  label: z.string().min(1).describe("Page label"),
1243
- markup: z.string().min(1).describe("Full Visualforce page markup (including <apex:page> tag)"),
1221
+ markup: z.string().optional().describe("Full Visualforce page markup (including <apex:page> tag)"),
1222
+ body: z.string().optional().describe("Alias for markup"),
1244
1223
  apiVersion: z.string().default("66.0").describe("API version"),
1245
1224
  availableInTouch: z.boolean().default(false).describe("Make available in Salesforce mobile"),
1246
1225
  showHeader: z.boolean().default(true).describe("Show Salesforce header"),
@@ -1260,48 +1239,52 @@ export const CreateAuraComponentSchema = z.object({
1260
1239
  // ─── REPORTS & DASHBOARDS (v2.2.0) ───────────────────────────────────────────
1261
1240
  const ReportFilterSchema = z.object({
1262
1241
  field: z.string().describe("Field API name, e.g. 'ACCOUNT_NAME'"),
1263
- operator: z.enum(["equals","notEqual","lessThan","greaterThan","lessOrEqual","greaterOrEqual","contains","notContain","startsWith","includes","excludes"]).describe("Filter operator"),
1242
+ operator: z.enum(["equals", "notEqual", "lessThan", "greaterThan", "lessOrEqual", "greaterOrEqual", "contains", "notContain", "startsWith", "includes", "excludes"]).describe("Filter operator"),
1264
1243
  value: z.string().describe("Filter value"),
1265
1244
  });
1266
1245
  export const CreateReportSchema = z.object({
1267
1246
  reportName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Report API name"),
1268
1247
  label: z.string().min(1).describe("Report display name"),
1269
1248
  reportType: z.string().min(1).describe("Report type API name, e.g. 'Account', 'Opportunity', 'AccountList'"),
1270
- format: z.enum(["Tabular","Summary","Matrix","Joined"]).default("Tabular").describe("Report format"),
1249
+ format: z.enum(["Tabular", "Summary", "Matrix", "Joined"]).default("Tabular").describe("Report format"),
1271
1250
  groupByField: z.string().optional().describe("Field to group by (Summary/Matrix formats)"),
1272
1251
  columns: z.array(z.string()).min(1).describe("Field API names to include as columns, e.g. ['ACCOUNT_NAME', 'ANNUAL_REVENUE']"),
1273
1252
  filters: z.array(ReportFilterSchema).optional().describe("Report filters"),
1274
1253
  description: z.string().optional().describe("Report description"),
1254
+ folderName: z.string().optional().describe("Folder API name for the report"),
1275
1255
  }).strict();
1276
1256
  export const UpdateDashboardSchema = z.object({
1277
1257
  dashboardName: z.string().min(1).describe("Dashboard API name"),
1278
1258
  componentsToAdd: z.array(z.object({
1279
1259
  reportName: z.string().describe("Report API name to add as component"),
1280
- chartType: z.enum(["Donut","Bar","Line","Column","Table","Metric","Gauge","HorizontalBar","Funnel"]).default("Table").describe("Chart type"),
1260
+ chartType: z.enum(["Donut", "Bar", "Line", "Column", "Table", "Metric", "Gauge", "HorizontalBar", "Funnel"]).default("Table").describe("Chart type"),
1281
1261
  title: z.string().describe("Component title"),
1282
1262
  row: z.number().int().default(0).describe("Row position (0-based)"),
1283
1263
  column: z.number().int().default(0).describe("Column position (0-based)"),
1284
1264
  })).optional().describe("Dashboard components to add"),
1285
1265
  componentsToRemove: z.array(z.string()).optional().describe("Component titles to remove"),
1266
+ label: z.string().optional().describe("New dashboard title/label"),
1267
+ runningUser: z.string().optional().describe("Username to run dashboard as"),
1286
1268
  }).strict();
1287
1269
  export const CreateReportFolderSchema = z.object({
1288
1270
  folderName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Folder API name"),
1289
1271
  label: z.string().min(1).describe("Folder display name"),
1290
- folderType: z.enum(["Report","Dashboard"]).describe("Whether this is a report or dashboard folder"),
1291
- accessType: z.enum(["Hidden","Shared","Public"]).default("Shared").describe("Folder access type"),
1272
+ folderType: z.enum(["Report", "Dashboard"]).default("Report").describe("Whether this is a report or dashboard folder"),
1273
+ accessType: z.enum(["Hidden", "Shared", "Public"]).default("Shared").describe("Folder access type"),
1292
1274
  }).strict();
1293
1275
  export const ShareReportFolderSchema = z.object({
1294
1276
  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"),
1277
+ folderType: z.enum(["Report", "Dashboard"]).default("Report").describe("Whether this is a report or dashboard folder"),
1278
+ accessLevel: z.string().optional().describe("Access level shorthand: View, Edit, Manage"),
1279
+ shareWith: z.preprocess((v) => typeof v === 'string' ? [{ type: "Group", name: v, accessLevel: "View" }] : v, z.array(z.object({
1280
+ type: z.enum(["Role", "Group", "User", "RoleAndSubordinates"]).describe("Sharing target type"),
1298
1281
  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"),
1282
+ accessLevel: z.enum(["View", "Edit", "Manage"]).default("View").describe("Access level"),
1283
+ })).min(1)).describe("Who to share the folder with"),
1301
1284
  }).strict();
1302
1285
  // ─── USERS & DATA (v2.2.0) ───────────────────────────────────────────────────
1303
1286
  export const CreateUserSchema = z.object({
1304
- firstName: z.string().min(1).describe("First name"),
1287
+ firstName: z.string().optional().describe("First name"),
1305
1288
  lastName: z.string().min(1).describe("Last name"),
1306
1289
  email: z.string().email().describe("Email address (also used for notifications)"),
1307
1290
  username: z.string().email().describe("Unique username (must be email format and unique across all Salesforce orgs)"),
@@ -1329,7 +1312,7 @@ export const CreatePublicGroupSchema = z.object({
1329
1312
  groupName: z.string().min(1).max(80).describe("Group developer name (no spaces)"),
1330
1313
  label: z.string().min(1).describe("Group display name"),
1331
1314
  members: z.array(z.object({
1332
- type: z.enum(["User","Role","RoleAndSubordinates","Group"]).describe("Member type"),
1315
+ type: z.enum(["User", "Role", "RoleAndSubordinates", "Group"]).describe("Member type"),
1333
1316
  name: z.string().describe("Username, role name, or group developer name"),
1334
1317
  })).optional().describe("Initial group members"),
1335
1318
  }).strict();
@@ -1348,7 +1331,7 @@ export const UpdateRecordSchema = z.object({
1348
1331
  }).strict();
1349
1332
  export const BulkImportRecordsSchema = z.object({
1350
1333
  objectApiName: z.string().min(1).describe("SObject API name, e.g. 'Account'"),
1351
- operation: z.enum(["insert","upsert","update","delete"]).describe("Bulk operation type"),
1334
+ operation: z.enum(["insert", "upsert", "update", "delete"]).describe("Bulk operation type"),
1352
1335
  records: z.array(z.record(z.unknown())).min(1).describe("Array of record objects with field API name to value mappings"),
1353
1336
  externalIdField: z.string().optional().describe("External ID field for upsert operations, e.g. 'External_Id__c'"),
1354
1337
  }).strict();
@@ -1360,21 +1343,24 @@ export const CreateOutboundMessageSchema = z.object({
1360
1343
  endpointUrl: z.string().url().describe("HTTPS endpoint URL to send the SOAP message to"),
1361
1344
  fields: z.array(z.string()).min(1).describe("Field API names to include in the outbound message payload"),
1362
1345
  useCallout: z.boolean().default(false).describe("Whether to use a named credential callout"),
1346
+ integrationUser: z.string().optional().describe("Username of the integration user (defaults to current user)"),
1363
1347
  description: z.string().optional().describe("Description"),
1364
1348
  }).strict();
1365
1349
  export const CreateAuthProviderSchema = z.object({
1366
1350
  providerName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Auth provider API name"),
1367
1351
  friendlyName: z.string().optional().describe("Display label (defaults to providerName)"),
1368
- providerType: z.enum(["Salesforce","Google","Facebook","OpenIdConnect","MicrosoftAad","LinkedIn","Custom"]).describe("Provider type"),
1352
+ providerType: z.enum(["Salesforce", "Google", "Facebook", "OpenIdConnect", "MicrosoftAad", "LinkedIn", "Custom"]).describe("Provider type"),
1369
1353
  consumerKey: z.string().min(1).describe("OAuth consumer key / client ID"),
1370
1354
  consumerSecret: z.string().min(1).describe("OAuth consumer secret / client secret"),
1371
1355
  defaultScopes: z.string().optional().describe("Default OAuth scopes, e.g. 'openid email profile'"),
1372
1356
  customErrorUrl: z.string().url().optional().describe("Custom error page URL"),
1357
+ authorizeEndpointUrl: z.string().optional().describe("Authorization endpoint URL"),
1358
+ tokenEndpointUrl: z.string().optional().describe("Token endpoint URL"),
1373
1359
  }).strict();
1374
1360
  // ─── DEPLOYMENT (v2.2.0) ──────────────────────────────────────────────────────
1375
1361
  export const ValidateDeploymentSchema = z.object({
1376
1362
  components: z.array(ComponentRefSchema).min(1).describe("Metadata components to validate"),
1377
- testLevel: z.enum(["NoTestRun","RunLocalTests","RunAllTestsInOrg"]).default("RunLocalTests").describe("Test level for validation"),
1363
+ testLevel: z.enum(["NoTestRun", "RunLocalTests", "RunAllTestsInOrg"]).default("RunLocalTests").describe("Test level for validation"),
1378
1364
  runTests: z.array(z.string()).optional().describe("Specific test classes to run"),
1379
1365
  waitMinutes: z.number().int().min(1).max(60).default(10).describe("Max minutes to wait for validation result"),
1380
1366
  }).strict();
@@ -1387,19 +1373,21 @@ export const PublishExperienceSiteSchema = z.object({
1387
1373
  }).strict();
1388
1374
  export const UpdateExperienceSiteSchema = z.object({
1389
1375
  siteName: z.string().min(1).describe("Experience Cloud site API name"),
1390
- status: z.enum(["Active","Inactive","UnderConstruction"]).optional().describe("Site status"),
1376
+ status: z.enum(["Active", "Inactive", "UnderConstruction"]).optional().describe("Site status"),
1391
1377
  description: z.string().optional().describe("Site description"),
1392
1378
  guestUserProfile: z.string().optional().describe("Guest user profile name"),
1393
1379
  }).strict();
1394
1380
  export const CreateNavigationMenuSchema = z.object({
1395
1381
  menuName: z.string().min(1).max(80).describe("Navigation menu API name"),
1396
1382
  label: z.string().min(1).describe("Menu label"),
1383
+ networkName: z.string().optional().describe("Experience site name (informational)"),
1384
+ items: z.array(z.any()).optional().describe("Alias for menuItems"),
1397
1385
  menuItems: z.array(z.object({
1398
1386
  label: z.string().describe("Menu item label"),
1399
- 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"),
1387
+ type: z.enum(["SalesforceObject", "ExternalUrl", "NavigationalTopic", "Event", "MenuLabel", "GlobalAction", "ContentPage"]).describe("Menu item type"),
1388
+ target: z.string().optional().describe("Target: object API name, URL, topic name, or event name"),
1401
1389
  position: z.number().int().optional().describe("Position (1-based)"),
1402
- })).min(1).describe("Navigation menu items"),
1390
+ })).optional().describe("Navigation menu items"),
1403
1391
  }).strict();
1404
1392
  export const CreateExperienceSiteMemberSchema = z.object({
1405
1393
  siteName: z.string().min(1).describe("Experience Cloud site API name"),
@@ -1416,14 +1404,14 @@ export const SetExperienceSiteBrandingSchema = z.object({
1416
1404
  }).strict();
1417
1405
  // ─── OMNISTUDIO (v2.3.0) ──────────────────────────────────────────────────────
1418
1406
  const OmniCardFieldSchema = z.object({ fieldName: z.string().min(1), label: z.string().min(1), type: z.string().default("Text") });
1419
- const OmniCardActionSchema = z.object({ label: z.string().min(1), type: z.enum(["omniscript","url","flow","navigation"]).default("navigation"), target: z.string().min(1) });
1407
+ const OmniCardActionSchema = z.object({ label: z.string().min(1), type: z.enum(["omniscript", "url", "flow", "navigation"]).default("navigation"), target: z.string().min(1) });
1420
1408
  const OmniCardStateConditionSchema = z.object({ field: z.string().min(1), operator: z.string().default("=="), value: z.string() });
1421
- const OmniCardStateSchema = z.object({ name: z.string().min(1), conditionType: z.enum(["ALL","ANY","CUSTOM"]).default("ALL"), conditions: z.array(OmniCardStateConditionSchema).optional() });
1409
+ const OmniCardStateSchema = z.object({ name: z.string().min(1), conditionType: z.enum(["ALL", "ANY", "CUSTOM"]).default("ALL"), conditions: z.array(OmniCardStateConditionSchema).optional() });
1422
1410
  export const CreateFlexCardSchema = z.object({
1423
1411
  cardName: z.string().min(1).max(80).describe("API name of the FlexCard (OmniUiCard)"),
1424
1412
  label: z.string().min(1).max(255).describe("Human-readable label"),
1425
1413
  objectApiName: z.string().optional().describe("Primary SObject, e.g. 'Account'"),
1426
- dataSourceType: z.enum(["SOQL","DataRaptor","Integration Procedure","Apex","None"]).default("SOQL"),
1414
+ dataSourceType: z.enum(["SOQL", "DataRaptor", "Integration Procedure", "Apex", "None"]).default("SOQL"),
1427
1415
  dataSourceName: z.string().optional().describe("SOQL query, DataRaptor name, or Integration Procedure name"),
1428
1416
  fields: z.array(OmniCardFieldSchema).optional().describe("Fields to display on the card"),
1429
1417
  actions: z.array(OmniCardActionSchema).optional().describe("Card actions"),
@@ -1433,7 +1421,7 @@ export const CreateFlexCardSchema = z.object({
1433
1421
  export const UpdateFlexCardSchema = z.object({
1434
1422
  cardName: z.string().min(1).max(80).describe("API name of the FlexCard to update"),
1435
1423
  label: z.string().optional(),
1436
- dataSourceType: z.enum(["SOQL","DataRaptor","Integration Procedure","Apex","None"]).optional(),
1424
+ dataSourceType: z.enum(["SOQL", "DataRaptor", "Integration Procedure", "Apex", "None"]).optional(),
1437
1425
  dataSourceName: z.string().optional(),
1438
1426
  fields: z.array(OmniCardFieldSchema).optional(),
1439
1427
  actions: z.array(OmniCardActionSchema).optional(),
@@ -1448,12 +1436,12 @@ export const GetFlexCardSchema = z.object({
1448
1436
  }).strict();
1449
1437
  const OmniElementSchema = z.object({
1450
1438
  name: z.string().min(1),
1451
- type: z.enum(["Text","Input","Select","Radio","Checkbox","Step","Group","TypeAhead","Formula","RemoteAction","DataRaptor","IntegrationProcedure","Disclosure","Navigation","Block"]),
1439
+ type: z.enum(["Text", "Input", "Select", "Radio", "Checkbox", "Step", "Group", "TypeAhead", "Formula", "RemoteAction", "DataRaptor", "IntegrationProcedure", "Disclosure", "Navigation", "Block"]),
1452
1440
  label: z.string().min(1),
1453
1441
  properties: z.record(z.unknown()).optional().describe("Element-specific configuration properties"),
1454
1442
  });
1455
1443
  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)"),
1444
+ scriptName: z.string().min(1).max(80).optional().describe("Ignored — fullName is derived from type_subType_language"),
1457
1445
  label: z.string().min(1).max(255),
1458
1446
  type: z.string().min(1).describe("OmniScript type, e.g. 'Account', 'Claims'"),
1459
1447
  subType: z.string().min(1).describe("OmniScript sub-type, e.g. 'Create', 'Edit'"),
@@ -1484,13 +1472,13 @@ export const GetOmniScriptSchema = z.object({
1484
1472
  const DataRaptorFieldMappingSchema = z.object({
1485
1473
  sourceField: z.string().min(1).describe("Source field path, e.g. 'Account.Name' or JSONPath '$.Name'"),
1486
1474
  targetField: z.string().min(1).describe("Target field or JSON key"),
1487
- dataType: z.enum(["String","Number","Boolean","Date","Object","Array"]).default("String"),
1475
+ dataType: z.enum(["String", "Number", "Boolean", "Date", "Object", "Array"]).default("String"),
1488
1476
  formula: z.string().optional().describe("Optional formula or transformation expression"),
1489
1477
  });
1490
1478
  export const CreateDataRaptorSchema = z.object({
1491
1479
  dataRaptorName: z.string().min(1).max(80).describe("API name of the DataRaptor"),
1492
1480
  label: z.string().min(1).max(255),
1493
- interfaceType: z.enum(["Extract","Transform","Load"]).describe("DataRaptor type: Extract reads from SF, Transform maps data, Load writes to SF"),
1481
+ interfaceType: z.enum(["Extract", "Transform", "Load"]).describe("DataRaptor type: Extract reads from SF, Transform maps data, Load writes to SF"),
1494
1482
  objectApiName: z.string().optional().describe("Primary SObject for Extract or Load (e.g. 'Account')"),
1495
1483
  fields: z.array(DataRaptorFieldMappingSchema).optional().describe("Field mappings"),
1496
1484
  filterCriteria: z.string().optional().describe("SOQL WHERE clause for Extract, e.g. 'Id = :recordId'"),
@@ -1501,7 +1489,7 @@ export const GetDataRaptorSchema = z.object({
1501
1489
  }).strict();
1502
1490
  const IPElementSchema = z.object({
1503
1491
  name: z.string().min(1),
1504
- type: z.enum(["DataRaptor","HTTPAction","Response","Loop","Conditional","SetValues","ExceptionBlock","Matrix","OmniScript","Aggregate"]),
1492
+ type: z.enum(["DataRaptor", "HTTPAction", "Response", "Loop", "Conditional", "SetValues", "ExceptionBlock", "Matrix", "OmniScript", "Aggregate"]),
1505
1493
  properties: z.record(z.unknown()).optional().describe("Element configuration (DataRaptor name, HTTP method/endpoint, etc.)"),
1506
1494
  inputMap: z.record(z.string()).optional().describe("Input parameter mappings {targetKey: 'sourceExpression'}"),
1507
1495
  outputMap: z.record(z.string()).optional().describe("Output parameter mappings {sourceKey: 'targetPath'}"),
@@ -1528,7 +1516,7 @@ export const ActivateIntegrationProcedureSchema = z.object({
1528
1516
  procedureName: z.string().min(1).max(80),
1529
1517
  subType: z.string().min(1),
1530
1518
  }).strict();
1531
- const CalcVariableSchema = z.object({ name: z.string().min(1), dataType: z.enum(["String","Number","Boolean","Date"]).default("String") });
1519
+ const CalcVariableSchema = z.object({ name: z.string().min(1), dataType: z.enum(["String", "Number", "Boolean", "Date"]).default("String") });
1532
1520
  export const CreateCalculationMatrixSchema = z.object({
1533
1521
  matrixName: z.string().min(1).max(80).describe("API name of the Calculation Matrix"),
1534
1522
  label: z.string().min(1).max(255),
@@ -1539,7 +1527,7 @@ export const CreateCalculationMatrixSchema = z.object({
1539
1527
  }).strict();
1540
1528
  const CalcStepSchema = z.object({
1541
1529
  name: z.string().min(1),
1542
- type: z.enum(["Matrix","Expression","Loop","Condition"]).default("Expression"),
1530
+ type: z.enum(["Matrix", "Expression", "Loop", "Condition"]).default("Expression"),
1543
1531
  matrixName: z.string().optional().describe("For Matrix steps: CalculationMatrix API name"),
1544
1532
  expression: z.string().optional().describe("For Expression steps: formula string"),
1545
1533
  inputMap: z.record(z.string()).optional(),
@@ -1555,17 +1543,20 @@ export const CreateCalculationProcedureSchema = z.object({
1555
1543
  export const CreateServiceChannelSchema = z.object({
1556
1544
  channelName: z.string().min(1).max(80).describe("API name / DeveloperName of the Service Channel"),
1557
1545
  label: z.string().min(1).max(255),
1558
- channelType: z.enum(["Case","Chat","Messaging","Voice","Email","SocialPost","Custom"]).default("Case"),
1546
+ channelType: z.enum(["Case", "Chat", "Messaging", "Voice", "Email", "SocialPost", "Custom", "Standard"]).default("Case"),
1559
1547
  relatedObjectApiName: z.string().optional().describe("SObject routed via this channel, default 'Case'"),
1560
1548
  capacity: z.number().int().min(1).max(100).default(1).describe("Capacity weight for this channel"),
1549
+ relatedObject: z.string().optional().describe("Alias for relatedObjectApiName"),
1561
1550
  }).strict();
1562
1551
  export const CreateRoutingConfigurationSchema = z.object({
1563
- configName: z.string().min(1).max(80).describe("API name of the RoutingConfiguration"),
1552
+ configName: z.string().optional().describe("API name of the RoutingConfiguration"),
1553
+ routingConfigName: z.string().optional().describe("Alias for configName"),
1554
+ routingPriority: z.number().int().optional().describe("Alias for priority"),
1564
1555
  label: z.string().min(1).max(255),
1565
- routingModel: z.enum(["LeastActive","MostAvailable","ExternalRouting"]).default("LeastActive"),
1556
+ routingModel: z.enum(["LeastActive", "MostAvailable", "ExternalRouting"]).default("LeastActive"),
1566
1557
  capacity: z.number().min(0).max(100).default(100).describe("Capacity percentage or item count"),
1567
1558
  priority: z.number().int().min(1).default(1).describe("Routing priority (lower number = higher priority)"),
1568
- unitType: z.enum(["Percentage","Items"]).default("Percentage"),
1559
+ unitType: z.enum(["Percentage", "Items"]).default("Percentage"),
1569
1560
  pushTimeout: z.number().int().min(0).optional().describe("Seconds before push routing times out (0 = no timeout)"),
1570
1561
  description: z.string().optional(),
1571
1562
  }).strict();
@@ -1577,14 +1568,17 @@ export const CreatePresenceConfigurationSchema = z.object({
1577
1568
  configName: z.string().min(1).max(80).describe("API name of the PresenceUserConfig"),
1578
1569
  label: z.string().min(1).max(255),
1579
1570
  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(),
1571
+ serviceChannels: z.array(z.union([
1572
+ z.string().transform((s) => ({ channelName: s })),
1573
+ z.object({ channelName: z.string().min(1), capacity: z.number().int().min(1).optional() }),
1574
+ ])).optional(),
1581
1575
  allowAgentsToChangeStatus: z.boolean().default(true),
1582
1576
  description: z.string().optional(),
1583
1577
  }).strict();
1584
1578
  export const CreatePresenceStatusSchema = z.object({
1585
1579
  statusName: z.string().min(1).max(80).describe("API name / DeveloperName of the Presence Status"),
1586
1580
  label: z.string().min(1).max(255),
1587
- statusType: z.enum(["Online","Busy","Offline"]).default("Online"),
1581
+ statusType: z.enum(["Online", "Busy", "Offline"]).default("Online"),
1588
1582
  serviceChannels: z.array(z.string()).optional().describe("ServiceChannel API names to associate"),
1589
1583
  }).strict();
1590
1584
  export const AssignPresenceStatusSchema = z.object({
@@ -1617,7 +1611,7 @@ export const CreateWorkTypeSchema = z.object({
1617
1611
  workTypeName: z.string().min(1).max(80).describe("Name of the Work Type"),
1618
1612
  label: z.string().min(1).max(255).describe("Display label (used as Name field)"),
1619
1613
  estimatedDuration: z.number().min(1).describe("Estimated work duration value"),
1620
- durationType: z.enum(["Minutes","Hours"]).default("Minutes"),
1614
+ durationType: z.enum(["Minutes", "Hours"]).default("Minutes"),
1621
1615
  blockTimeBeforeWork: z.number().min(0).default(0).describe("Buffer time before work in minutes"),
1622
1616
  blockTimeAfterWork: z.number().min(0).default(0).describe("Buffer time after work in minutes"),
1623
1617
  skillRequirements: z.array(z.string()).optional().describe("Required Skill DeveloperNames"),
@@ -1626,10 +1620,10 @@ export const CreateWorkTypeSchema = z.object({
1626
1620
  export const CreateMessagingChannelSchema = z.object({
1627
1621
  channelName: z.string().min(1).max(80).describe("API name / MasterLabel for the Messaging Channel"),
1628
1622
  label: z.string().min(1).max(255),
1629
- channelType: z.enum(["SMS","WhatsApp","Facebook","AppleMessages","GoogleBusinessMessages","LINE","Voice"]),
1623
+ channelType: z.enum(["SMS", "WhatsApp", "Facebook", "AppleMessages", "GoogleBusinessMessages", "LINE", "Voice", "EmbeddedMessaging"]),
1630
1624
  phoneNumber: z.string().optional().describe("Phone number for SMS/WhatsApp channels"),
1631
1625
  pageId: z.string().optional().describe("Facebook Page ID for Facebook Messenger"),
1632
- routingType: z.enum(["Queue","Bot","None"]).default("Queue"),
1626
+ routingType: z.enum(["Queue", "Bot", "None"]).default("Queue"),
1633
1627
  queueName: z.string().optional().describe("Queue DeveloperName to route work items to"),
1634
1628
  botName: z.string().optional().describe("Bot API name for bot-first routing"),
1635
1629
  description: z.string().optional(),
@@ -1637,7 +1631,7 @@ export const CreateMessagingChannelSchema = z.object({
1637
1631
  export const CreateChatButtonSchema = z.object({
1638
1632
  buttonName: z.string().min(1).max(80).describe("API name / DeveloperName of the chat button"),
1639
1633
  label: z.string().min(1).max(255),
1640
- routingType: z.enum(["Queue","Bot"]).default("Queue"),
1634
+ routingType: z.enum(["Queue", "Bot"]).default("Queue"),
1641
1635
  queueName: z.string().optional().describe("Queue DeveloperName for queue-based routing"),
1642
1636
  botName: z.string().optional().describe("Bot name for bot-first routing"),
1643
1637
  windowLanguage: z.string().default("en").describe("Chat window language code, e.g. 'en', 'fr', 'de'"),
@@ -1647,10 +1641,11 @@ export const CreateChatButtonSchema = z.object({
1647
1641
  description: z.string().optional(),
1648
1642
  }).strict();
1649
1643
  export const CreateEmbeddedServiceSchema = z.object({
1650
- deploymentName: z.string().min(1).max(80).describe("API name of the Embedded Service deployment"),
1644
+ deploymentName: z.string().optional().describe("API name of the Embedded Service deployment"),
1645
+ serviceName: z.string().optional().describe("Alias for deploymentName"),
1651
1646
  label: z.string().min(1).max(255),
1652
1647
  site: z.string().min(1).describe("Experience Cloud site name or 'none' for non-community deployment"),
1653
- channelType: z.enum(["LiveAgent","MessagingChannel"]).default("LiveAgent"),
1648
+ channelType: z.enum(["LiveAgent", "MessagingChannel", "EmbeddedMessaging"]).default("LiveAgent"),
1654
1649
  chatButtonName: z.string().optional().describe("LiveChatButton API name (for LiveAgent)"),
1655
1650
  messagingChannelName: z.string().optional().describe("MessagingChannel API name (for MessagingChannel)"),
1656
1651
  primaryColor: z.string().optional().describe("Primary brand color hex, e.g. '#0070D2'"),
@@ -1663,8 +1658,8 @@ export const CreateBotRoutingSchema = z.object({
1663
1658
  transferToQueueName: z.string().min(1).describe("Queue DeveloperName to transfer conversation to"),
1664
1659
  transferMessage: z.string().optional().describe("Message shown to customer when transferring to agent"),
1665
1660
  escalationConditions: z.array(z.object({
1666
- trigger: z.enum(["agentRequested","unrecognized","maxErrorCount","custom"]).describe("Trigger condition for escalation"),
1667
- action: z.enum(["TransferToQueue","EndChat","SetVariable"]).default("TransferToQueue"),
1661
+ trigger: z.enum(["agentRequested", "unrecognized", "maxErrorCount", "custom"]).describe("Trigger condition for escalation"),
1662
+ action: z.enum(["TransferToQueue", "EndChat", "SetVariable"]).default("TransferToQueue"),
1668
1663
  })).optional().describe("Conditions that trigger transfer to human agent"),
1669
1664
  }).strict();
1670
1665
  // ─── v2.4.0 — NEW TOOLS ──────────────────────────────────────────────────────
@@ -1680,50 +1675,54 @@ export const DeleteRecordSchema = z.object({
1680
1675
  recordId: z.string().min(15).max(18).describe("15 or 18 character Salesforce record ID"),
1681
1676
  }).strict();
1682
1677
  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'"),
1678
+ startDate: z.string().optional().describe("Start date in ISO format, e.g. '2025-01-01'"),
1679
+ endDate: z.string().optional().describe("End date in ISO format, e.g. '2025-12-31'"),
1685
1680
  createdByUsername: z.string().optional().describe("Filter by the username who made the change"),
1686
1681
  section: z.string().optional().describe("Filter by section, e.g. 'Custom Fields', 'Profiles', 'Flows', 'Apex Classes'"),
1687
1682
  limit: z.number().int().min(1).max(2000).default(100).describe("Maximum records to return"),
1688
1683
  }).strict();
1689
1684
  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'"),
1685
+ startDate: z.string().optional().describe("Start date in ISO format, e.g. '2025-01-01'"),
1686
+ endDate: z.string().optional().describe("End date in ISO format, e.g. '2025-12-31'"),
1692
1687
  username: z.string().optional().describe("Filter by Salesforce username"),
1693
1688
  status: z.string().optional().describe("Filter by login status, e.g. 'Success', 'Failed'"),
1694
1689
  limit: z.number().int().min(1).max(2000).default(100).describe("Maximum records to return"),
1695
1690
  }).strict();
1696
1691
  export const GetEventLogsSchema = z.object({
1697
1692
  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'"),
1693
+ startDate: z.string().optional().describe("Start date in ISO format, e.g. '2025-01-01'"),
1694
+ endDate: z.string().optional().describe("End date in ISO format, e.g. '2025-12-31'"),
1700
1695
  limit: z.number().int().min(1).max(50).default(10).describe("Maximum log files to fetch"),
1701
1696
  }).strict();
1702
1697
  export const GetFieldHistorySchema = z.object({
1703
1698
  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"),
1699
+ recordId: z.string().min(15).describe("Record ID to fetch history for (15 or 18 characters)"),
1705
1700
  fields: z.array(z.string()).optional().describe("Optional field names to filter — returns all tracked fields if omitted"),
1706
1701
  limit: z.number().int().min(1).max(500).default(100).describe("Maximum history records to return"),
1707
1702
  }).strict();
1708
1703
  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"),
1711
- metadataTypes: z.array(z.string()).default(["ApexClass","Flow","CustomObject","PermissionSet","LightningComponentBundle"]).describe("Metadata types to compare"),
1704
+ sourceAlias: z.string().optional().describe("SF CLI alias for the source org (run: sf org list to see aliases)"),
1705
+ targetAlias: z.string().optional().describe("SF CLI alias for the target org"),
1706
+ metadataType: z.string().optional().describe("Single metadata type to compare"),
1707
+ limit: z.number().int().optional().describe("Maximum results to return"),
1708
+ metadataTypes: z.array(z.string()).default(["ApexClass", "Flow", "CustomObject", "PermissionSet", "LightningComponentBundle"]).describe("Metadata types to compare"),
1712
1709
  }).strict();
1713
1710
  export const CreateCertificateSchema = z.object({
1714
1711
  certName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Certificate API name"),
1715
1712
  label: z.string().min(1).describe("Certificate display label"),
1716
- keySize: z.enum(["2048","4096"]).default("2048").describe("Key size in bits"),
1713
+ keySize: z.preprocess((v) => typeof v === 'number' ? String(v) : v, z.enum(["2048", "4096"]).default("2048")).describe("Key size in bits: 2048 or 4096 (number or string)"),
1717
1714
  expirationDate: z.string().optional().describe("Expiration date in ISO format, e.g. '2030-01-01'"),
1718
1715
  privateKeyExportable: z.boolean().default(false).describe("Whether the private key can be exported"),
1719
1716
  }).strict();
1720
1717
  export const CreateEventRelaySchema = z.object({
1721
1718
  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"),
1726
- state: z.enum(["RUN","STOP","PAUSE"]).default("RUN").describe("Initial relay state"),
1719
+ label: z.string().optional().describe("Display label"),
1720
+ eventChannel: z.string().optional().describe("Platform event or CDC channel API name, e.g. 'My_Event__e' or 'AccountChangeEvent'"),
1721
+ platformEventName: z.string().optional().describe("Alias for eventChannel"),
1722
+ relayChannel: z.string().optional().describe("Channel name for relay"),
1723
+ destinationType: z.enum(["AmazonEventBus", "AmazonEventBridge", "EventBus"]).optional().describe("Destination type for the relay"),
1724
+ destinationResourceName: z.string().optional().describe("ARN or event bus name for the destination"),
1725
+ state: z.enum(["RUN", "STOP", "PAUSE"]).default("RUN").describe("Initial relay state"),
1727
1726
  description: z.string().optional().describe("Relay description"),
1728
1727
  }).strict();
1729
1728
  export const CreateLetterheadSchema = z.object({
@@ -1739,6 +1738,7 @@ export const CreateLetterheadSchema = z.object({
1739
1738
  footerText: z.string().optional().describe("Footer text content"),
1740
1739
  topLineColor: z.string().default("#0070D2").describe("Top separator line color"),
1741
1740
  bottomLineColor: z.string().default("#0070D2").describe("Bottom separator line color"),
1741
+ backgroundColor: z.string().optional().describe("Alias for bodyColor"),
1742
1742
  }).strict();
1743
1743
  export const SendEmailSchema = z.object({
1744
1744
  toAddresses: z.array(z.string()).min(1).describe("Recipient email addresses"),
@@ -1755,8 +1755,9 @@ export const SendEmailSchema = z.object({
1755
1755
  export const CreateEinsteinPredictionSchema = z.object({
1756
1756
  predictionName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Prediction API name"),
1757
1757
  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"),
1758
+ objectApiName: z.string().optional().describe("Salesforce object to run predictions on, e.g. 'Opportunity'"),
1759
+ objectName: z.string().optional().describe("Alias for objectApiName"),
1760
+ predictionType: z.preprocess((v) => v === 'Classification' ? 'BinaryClassification' : v, z.enum(["BinaryClassification", "Regression", "Classification"])).describe("BinaryClassification/Classification for yes/no, Regression for numeric"),
1760
1761
  targetField: z.string().min(1).describe("Field API name to predict"),
1761
1762
  positiveLabel: z.string().default("Yes").describe("Label for positive outcome (BinaryClassification only)"),
1762
1763
  negativeLabel: z.string().default("No").describe("Label for negative outcome (BinaryClassification only)"),
@@ -1766,7 +1767,7 @@ export const CreateEinsteinPredictionSchema = z.object({
1766
1767
  export const CreateNextBestActionSchema = z.object({
1767
1768
  strategyName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Strategy API name"),
1768
1769
  label: z.string().min(1).describe("Strategy display label"),
1769
- contextObjectApiName: z.string().min(1).describe("Object that provides context, e.g. 'Account', 'Case'"),
1770
+ contextObjectApiName: z.string().optional().describe("Object that provides context, e.g. 'Account', 'Case'"),
1770
1771
  recommendations: z.array(z.object({
1771
1772
  name: z.string().min(1).describe("Recommendation developer name"),
1772
1773
  label: z.string().min(1).describe("Label shown to users"),
@@ -1784,7 +1785,7 @@ export const CreateEinsteinBotSchema = z.object({
1784
1785
  dialogs: z.array(z.object({
1785
1786
  name: z.string().min(1).describe("Dialog developer name"),
1786
1787
  label: z.string().min(1).describe("Dialog display label"),
1787
- type: z.enum(["Main","System","Rule"]).default("Main").describe("Dialog type"),
1788
+ type: z.enum(["Main", "System", "Rule"]).default("Main").describe("Dialog type"),
1788
1789
  isGoalStep: z.boolean().default(false).describe("Whether this dialog represents goal completion"),
1789
1790
  utterances: z.array(z.string()).optional().describe("Training utterances that trigger this dialog"),
1790
1791
  messages: z.array(z.string()).optional().describe("Bot messages to show"),
@@ -1795,10 +1796,10 @@ export const CreateUserRoleHierarchySchema = z.object({
1795
1796
  roleName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Role API name"),
1796
1797
  label: z.string().min(1).describe("Role display label"),
1797
1798
  parentRoleName: z.string().optional().describe("Parent role API name (omit for top-level)"),
1798
- caseAccessLevel: z.enum(["None","Read","Edit","ReadWrite"]).default("ReadWrite").describe("Case access for subordinates"),
1799
- contactAccessLevel: z.enum(["None","Read","Edit","ReadWrite"]).default("ReadWrite").describe("Contact access for subordinates"),
1800
- opportunityAccessLevel: z.enum(["None","Read","Edit","ReadWrite"]).default("ReadWrite").describe("Opportunity access for subordinates"),
1801
- accountAccessLevel: z.enum(["None","Read","Edit","ReadWrite"]).default("ReadWrite").describe("Account access for subordinates"),
1799
+ caseAccessLevel: z.enum(["None", "Read", "Edit", "ReadWrite"]).default("ReadWrite").describe("Case access for subordinates"),
1800
+ contactAccessLevel: z.enum(["None", "Read", "Edit", "ReadWrite"]).default("ReadWrite").describe("Contact access for subordinates"),
1801
+ opportunityAccessLevel: z.enum(["None", "Read", "Edit", "ReadWrite"]).default("ReadWrite").describe("Opportunity access for subordinates"),
1802
+ accountAccessLevel: z.enum(["None", "Read", "Edit", "ReadWrite"]).default("ReadWrite").describe("Account access for subordinates"),
1802
1803
  mayForecastManagerShare: z.boolean().default(true).describe("Grant manager forecast sharing"),
1803
1804
  description: z.string().optional().describe("Role description"),
1804
1805
  }).strict();
@@ -1813,20 +1814,21 @@ export const FreezeUserSchema = z.object({
1813
1814
  export const CreateETMTerritorySchema = z.object({
1814
1815
  territoryName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Territory API name"),
1815
1816
  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"),
1818
- accountAccessLevel: z.enum(["View","Edit","All","None"]).default("View").describe("Account access for territory members"),
1819
- opportunityAccessLevel: z.enum(["View","Edit","All","None"]).default("View").describe("Opportunity access"),
1820
- caseAccessLevel: z.enum(["View","Edit","All","None"]).default("View").describe("Case access"),
1817
+ territoryType: z.string().optional().describe("Territory2Type API name (must exist in org)"),
1818
+ parentTerritoryName: z.union([z.string(), z.null()]).optional().describe("Parent territory name for hierarchy"),
1819
+ accountAccessLevel: z.enum(["View", "Edit", "All", "None"]).default("View").describe("Account access for territory members"),
1820
+ opportunityAccessLevel: z.enum(["View", "Edit", "All", "None"]).default("View").describe("Opportunity access"),
1821
+ caseAccessLevel: z.enum(["View", "Edit", "All", "None"]).default("View").describe("Case access"),
1821
1822
  description: z.string().optional().describe("Territory description"),
1822
1823
  }).strict();
1823
1824
  export const AssignTerritoryToUserSchema = z.object({
1824
1825
  territoryName: z.string().min(1).describe("Territory API name to assign user to"),
1825
1826
  username: z.string().min(1).describe("Salesforce username to assign"),
1826
- roleInTerritory: z.enum(["Salesperson","AccountManager","Owner"]).default("Salesperson").describe("User role within the territory"),
1827
+ roleInTerritory: z.enum(["Salesperson", "AccountManager", "Owner"]).default("Salesperson").describe("User role within the territory"),
1827
1828
  }).strict();
1828
1829
  export const CreateForecastHierarchySchema = z.object({
1829
- forecastingType: z.enum(["OpportunityRevenue","OpportunityQuantity","OverlayRevenue","OverlayQuantity","ProductFamily"]).describe("Forecasting type"),
1830
+ forecastingType: z.enum(["OpportunityRevenue", "OpportunityQuantity", "OverlayRevenue", "OverlayQuantity", "ProductFamily"]).default("OpportunityRevenue").describe("Forecasting type"),
1831
+ roleName: z.string().optional().describe("Role name (informational)"),
1830
1832
  displayCurrency: z.string().default("USD").describe("Currency code for display (e.g. 'USD', 'EUR')"),
1831
1833
  isActive: z.boolean().default(true).describe("Enable this forecasting type"),
1832
1834
  }).strict();
@@ -1840,24 +1842,30 @@ export const DeleteCustomFieldSchema = z.object({
1840
1842
  confirmDelete: z.boolean().describe("Must be true to confirm deletion — this is permanent"),
1841
1843
  }).strict();
1842
1844
  export const CreateRollupSummaryFieldSchema = z.object({
1843
- objectApiName: z.string().min(1).describe("Master object API name to add the rollup field to"),
1845
+ objectApiName: z.string().optional().describe("Master object API name to add the rollup field to"),
1846
+ objectName: z.string().optional().describe("Alias for objectApiName"),
1844
1847
  fieldName: z.string().min(1).max(40).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Field API name (without __c)"),
1845
1848
  label: z.string().min(1).describe("Field display label"),
1846
1849
  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"),
1850
+ summaryType: z.enum(["COUNT", "SUM", "MIN", "MAX"]).optional().describe("Aggregation type"),
1851
+ summaryOperation: z.enum(["COUNT", "SUM", "MIN", "MAX"]).optional().describe("Alias for summaryType"),
1852
+ relationshipField: z.string().optional().describe("Relationship field on child object"),
1848
1853
  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"),
1854
+ filterCriteria: z.union([
1855
+ z.string(),
1856
+ z.array(z.object({
1857
+ field: z.string().describe("Child field API name"),
1858
+ operator: z.enum(["equals", "notEqual", "lessThan", "greaterThan", "lessOrEqual", "greaterOrEqual", "contains", "notContain", "startsWith"]).describe("Filter operator"),
1859
+ value: z.string().describe("Filter value"),
1860
+ })),
1861
+ ]).optional().describe("Filter criteria: string SOQL-like expression or array of {field,operator,value} objects"),
1854
1862
  description: z.string().optional().describe("Field description"),
1855
1863
  }).strict();
1856
1864
  export const CreateExternalIdFieldSchema = z.object({
1857
1865
  objectApiName: z.string().min(1).describe("Object API name to add the field to"),
1858
1866
  fieldName: z.string().min(1).max(40).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Field API name (without __c)"),
1859
1867
  label: z.string().min(1).describe("Field display label"),
1860
- fieldType: z.enum(["Text","Number","Email","AutoNumber"]).default("Text").describe("Field data type"),
1868
+ fieldType: z.enum(["Text", "Number", "Email", "AutoNumber"]).default("Text").describe("Field data type"),
1861
1869
  isUnique: z.boolean().default(true).describe("Enforce unique values"),
1862
1870
  isCaseSensitive: z.boolean().default(false).describe("Case-sensitive uniqueness enforcement (Text only)"),
1863
1871
  length: z.number().int().default(80).describe("Field length (Text fields only)"),
@@ -1878,23 +1886,27 @@ export const UpdateFlowSchema = z.object({
1878
1886
  newDescription: z.string().optional().describe("New description for the flow"),
1879
1887
  variablesToAdd: z.array(z.object({
1880
1888
  name: z.string().min(1).describe("Variable API name"),
1881
- dataType: z.enum(["String","Number","Currency","Boolean","Date","DateTime","SObject","Apex","Multipicklist","Picklist"]).describe("Variable data type"),
1889
+ dataType: z.enum(["String", "Number", "Currency", "Boolean", "Date", "DateTime", "SObject", "Apex", "Multipicklist", "Picklist"]).describe("Variable data type"),
1882
1890
  isInput: z.boolean().default(false).describe("Available for input"),
1883
1891
  isOutput: z.boolean().default(false).describe("Available for output"),
1884
1892
  objectType: z.string().optional().describe("SObject API name (for SObject dataType)"),
1885
1893
  defaultValue: z.string().optional().describe("Default value expression"),
1886
1894
  })).optional().describe("Variables to add to the flow"),
1895
+ label: z.string().optional().describe("Alias for newLabel"),
1896
+ description: z.string().optional().describe("Alias for newDescription"),
1887
1897
  }).strict();
1888
1898
  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"),
1899
+ sourceFlowApiName: z.string().optional().describe("Source flow API name to clone"),
1900
+ sourceFlowName: z.string().optional().describe("Alias for sourceFlowApiName"),
1901
+ newFlowApiName: z.string().optional().describe("New flow API name"),
1902
+ newFlowName: z.string().optional().describe("Alias for newFlowApiName"),
1903
+ newLabel: z.string().optional().describe("New flow display label"),
1892
1904
  activateImmediately: z.boolean().default(false).describe("Activate the cloned flow immediately"),
1893
1905
  }).strict();
1894
1906
  export const CreateFlowTestSchema = z.object({
1895
1907
  flowApiName: z.string().min(1).describe("Flow API name to test"),
1896
1908
  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"),
1909
+ label: z.string().optional().describe("Test display label"),
1898
1910
  description: z.string().optional().describe("Test description"),
1899
1911
  inputs: z.array(z.object({
1900
1912
  name: z.string().describe("Variable name"),
@@ -1913,22 +1925,30 @@ export const CreateInvocableActionSchema = z.object({
1913
1925
  inputs: z.array(z.object({
1914
1926
  name: z.string().min(1).describe("Input variable name"),
1915
1927
  label: z.string().min(1).describe("Input variable label"),
1916
- dataType: z.enum(["String","Integer","Long","Double","Boolean","Date","Datetime","Id","sObject"]).describe("Data type"),
1928
+ dataType: z.enum(["String", "Integer", "Long", "Double", "Boolean", "Date", "Datetime", "Id", "sObject"]).describe("Data type"),
1917
1929
  required: z.boolean().default(false).describe("Is input required"),
1918
1930
  sObjectType: z.string().optional().describe("SObject API name if dataType=sObject"),
1919
1931
  })).default([]).describe("Input parameters"),
1920
1932
  outputs: z.array(z.object({
1921
1933
  name: z.string().min(1).describe("Output variable name"),
1922
1934
  label: z.string().min(1).describe("Output variable label"),
1923
- dataType: z.enum(["String","Integer","Long","Double","Boolean","Date","Datetime","Id","sObject"]).describe("Data type"),
1935
+ dataType: z.enum(["String", "Integer", "Long", "Double", "Boolean", "Date", "Datetime", "Id", "sObject"]).describe("Data type"),
1924
1936
  sObjectType: z.string().optional().describe("SObject API name if dataType=sObject"),
1925
1937
  })).default([]).describe("Output parameters"),
1938
+ className: z.string().optional().describe("Apex class name (informational)"),
1939
+ method: z.string().optional().describe("Method name (informational)"),
1926
1940
  }).strict();
1927
1941
  export const SearchApexSchema = z.object({
1928
1942
  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"),
1943
+ searchIn: z.preprocess((v) => {
1944
+ if (typeof v !== 'string')
1945
+ return v;
1946
+ const map = { classes: 'Classes', triggers: 'Triggers', both: 'Both', body: 'Both', all: 'Both' };
1947
+ return map[v.toLowerCase()] ?? v;
1948
+ }, z.enum(["Classes", "Triggers", "Both"]).default("Both")).describe("Where to search: 'Classes', 'Triggers', or 'Both' (also accepts lowercase)"),
1930
1949
  caseSensitive: z.boolean().default(false).describe("Case-sensitive search"),
1931
1950
  limit: z.number().int().default(50).describe("Maximum number of results"),
1951
+ searchType: z.string().optional().describe("Alias for searchIn: class/classes/trigger/triggers/both"),
1932
1952
  }).strict();
1933
1953
  export const GetApexLogsSchema = z.object({
1934
1954
  username: z.string().optional().describe("Filter logs by Salesforce username"),
@@ -1940,7 +1960,9 @@ export const GetApexLogBodySchema = z.object({
1940
1960
  }).strict();
1941
1961
  export const CreateApexBatchSchema = z.object({
1942
1962
  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'"),
1963
+ sObjectType: z.string().optional().describe("SObject type to query and process, e.g. 'Account'"),
1964
+ objectApiName: z.string().optional().describe("Alias for sObjectType"),
1965
+ queryFields: z.array(z.string()).optional().describe("Fields to include in query"),
1944
1966
  queryFilter: z.string().optional().describe("SOQL WHERE clause for start method, e.g. \"CreatedDate = TODAY\""),
1945
1967
  batchSize: z.number().int().default(200).describe("Batch size (records per execute call, 1-2000)"),
1946
1968
  description: z.string().optional().describe("Class description / what the batch does"),
@@ -1949,7 +1971,8 @@ export const CreateApexBatchSchema = z.object({
1949
1971
  }).strict();
1950
1972
  export const CreateApexSchedulerSchema = z.object({
1951
1973
  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"),
1974
+ jobName: z.string().optional().describe("Default schedule job name"),
1975
+ batchClass: z.string().optional().describe("Batch class to schedule (alias for batchClassName)"),
1953
1976
  cronExpression: z.string().default("0 0 2 * * ?").describe("Default cron expression, e.g. '0 0 2 * * ?' (daily at 2am)"),
1954
1977
  batchClassName: z.string().optional().describe("Batch class to execute (if this scheduler runs a batch)"),
1955
1978
  description: z.string().optional().describe("Class description"),
@@ -1962,13 +1985,13 @@ export const CreateScratchOrgSchema = z.object({
1962
1985
  devHubAlias: z.string().default("DevHub").describe("SF CLI alias for the Dev Hub org"),
1963
1986
  duration: z.number().int().min(1).max(30).default(7).describe("Scratch org lifetime in days (1–30)"),
1964
1987
  features: z.array(z.string()).default([]).describe("Scratch org features, e.g. ['Communities', 'ServiceCloud']"),
1965
- edition: z.enum(["Developer","Enterprise","Group","Professional"]).default("Developer").describe("Scratch org edition"),
1988
+ edition: z.enum(["Developer", "Enterprise", "Group", "Professional"]).default("Developer").describe("Scratch org edition"),
1966
1989
  adminEmail: z.string().optional().describe("Admin email for the scratch org"),
1967
1990
  description: z.string().optional().describe("Description for the scratch org"),
1968
1991
  }).strict();
1969
1992
  export const CreateSandboxSchema = z.object({
1970
1993
  sandboxName: z.string().min(1).max(10).regex(/^[A-Za-z][A-Za-z0-9]*$/).describe("Sandbox name (max 10 chars, alphanumeric)"),
1971
- sandboxType: z.enum(["Developer","Developer_Pro","Partial","Full"]).describe("Sandbox type/license"),
1994
+ sandboxType: z.enum(["Developer", "Developer_Pro", "Partial", "Full"]).describe("Sandbox type/license"),
1972
1995
  description: z.string().optional().describe("Sandbox description"),
1973
1996
  autoActivate: z.boolean().default(true).describe("Auto-activate after creation"),
1974
1997
  apexClassId: z.string().optional().describe("Apex class ID to run after sandbox copy (post-copy script)"),
@@ -1980,9 +2003,10 @@ export const RefreshSandboxSchema = z.object({
1980
2003
  apexClassId: z.string().optional().describe("Apex class ID to run after refresh (post-copy script)"),
1981
2004
  }).strict();
1982
2005
  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.)"),
2006
+ metadataTypes: z.preprocess((v) => Array.isArray(v) ? v.map((item) => typeof item === 'object' && item !== null ? (item.type || item.name || String(item)) : item) : v, z.array(z.string()).default([])).describe("Metadata types to include: strings or {type, name} objects. Empty = all common types."),
1984
2007
  includeManaged: z.boolean().default(false).describe("Include managed package components"),
1985
2008
  apiVersion: z.string().optional().describe("API version for the package.xml (defaults to current API_VERSION)"),
2009
+ components: z.any().optional().describe("Alias: array of {type, members} objects"),
1986
2010
  }).strict();
1987
2011
  export const CreateExperienceContainerSchema = z.object({
1988
2012
  pageName: z.string().min(1).describe("FlexiPage API name to add the container to"),
@@ -1996,20 +2020,26 @@ export const SetExperienceSiteLoginSchema = z.object({
1996
2020
  selfRegistrationEnabled: z.boolean().default(false).describe("Allow users to self-register"),
1997
2021
  selfRegistrationProfileName: z.string().optional().describe("Default profile for self-registered users"),
1998
2022
  forgotPasswordEnabled: z.boolean().default(true).describe("Show forgot password link"),
1999
- loginPageType: z.enum(["Standard","Custom"]).default("Standard").describe("Standard Salesforce login or custom login page"),
2023
+ loginPageType: z.enum(["Standard", "Custom"]).default("Standard").describe("Standard Salesforce login or custom login page"),
2000
2024
  customLoginUrl: z.string().optional().describe("Custom login page URL (for Custom loginPageType)"),
2001
2025
  }).strict();
2002
2026
  export const CreateCmsContentSchema = z.object({
2003
2027
  contentName: z.string().min(1).max(255).describe("CMS content name"),
2004
- contentType: z.enum(["News","Document","Image","custom"]).describe("CMS content type"),
2028
+ contentType: z.preprocess((v) => typeof v === 'string' ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v, z.enum(["News", "Document", "Image", "Custom", "custom"])).describe("CMS content type: 'News', 'Document', 'Image', or 'custom' (case-insensitive)"),
2005
2029
  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...'}"),
2030
+ fields: z.union([
2031
+ z.record(z.string()),
2032
+ z.array(z.object({ name: z.string(), value: z.string() })).transform((arr) => Object.fromEntries(arr.map((f) => [f.name, f.value]))),
2033
+ ]).describe("Content field key-value pairs, e.g. {title: 'My Title', body: 'Content...'}"),
2007
2034
  channelNames: z.array(z.string()).optional().describe("Experience Cloud site names to publish content to"),
2035
+ title: z.string().optional().describe("Content title (mapped to fields.title)"),
2036
+ body: z.string().optional().describe("Content body (mapped to fields.body)"),
2008
2037
  }).strict();
2009
2038
  export const ExportRecordsSchema = z.object({
2010
2039
  query: z.string().min(1).describe("Full SOQL query string"),
2011
2040
  includeHeaders: z.boolean().default(true).describe("Include CSV header row"),
2012
2041
  limit: z.number().int().default(2000).describe("Maximum records to export"),
2042
+ format: z.string().optional().describe("Export format: json or csv"),
2013
2043
  }).strict();
2014
2044
  export const UpsertRecordSchema = z.object({
2015
2045
  objectApiName: z.string().min(1).describe("SObject API name, e.g. 'Account'"),
@@ -2019,36 +2049,45 @@ export const UpsertRecordSchema = z.object({
2019
2049
  }).strict();
2020
2050
  export const GetRecordSchema = z.object({
2021
2051
  objectApiName: z.string().min(1).describe("SObject API name, e.g. 'Account'"),
2022
- recordId: z.string().min(15).max(18).describe("Record ID"),
2052
+ recordId: z.string().min(15).describe("Record ID (15 or 18 characters)"),
2023
2053
  fields: z.array(z.string()).optional().describe("Field API names to retrieve. Empty = all available fields"),
2024
2054
  }).strict();
2025
2055
  export const SearchRecordsSchema = z.object({
2026
2056
  searchTerm: z.string().min(1).describe("Search term (SOSL FIND clause value, no quotes needed)"),
2027
- objects: z.array(z.object({
2057
+ objectTypes: z.array(z.string()).optional().describe("Alias for objects: array of object API name strings"),
2058
+ objects: z.preprocess((v) => Array.isArray(v) ? v.map((item) => typeof item === 'string' ? { objectName: item, fields: ["Id", "Name"] } : item) : v, z.array(z.object({
2028
2059
  objectName: z.string().describe("SObject API name"),
2029
2060
  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"),
2061
+ })).default([{ objectName: "Account", fields: ["Id", "Name"] }, { objectName: "Contact", fields: ["Id", "Name", "Email"] }])).describe("Objects to search across: strings or {objectName, fields} objects"),
2031
2062
  limit: z.number().int().default(20).describe("Maximum results per object"),
2032
2063
  }).strict();
2033
2064
  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"),
2065
+ eventApiName: z.string().optional().describe("Platform event API name, e.g. 'My_Event__e'"),
2066
+ platformEventName: z.string().optional().describe("Alias for eventApiName"),
2067
+ subscriptionType: z.enum(["Trigger", "Flow"]).default("Flow").describe("Subscribe via Apex trigger or Flow"),
2068
+ subscriberName: z.string().optional().describe("API name of the trigger or flow to create/reference"),
2069
+ subscriberFlowName: z.string().optional().describe("Alias for subscriberName"),
2070
+ description: z.string().optional().describe("Description"),
2037
2071
  apexCode: z.string().optional().describe("Apex trigger body (for Trigger type). Auto-generated if omitted."),
2038
2072
  }).strict();
2039
2073
  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'"),
2074
+ objectApiName: z.string().optional().describe("Object API name to enable CDC for, e.g. 'Account', 'Contact', 'My_Object__c'"),
2075
+ objectName: z.string().optional().describe("Alias for objectApiName"),
2041
2076
  enabled: z.boolean().default(true).describe("Enable or disable CDC for this object"),
2042
2077
  }).strict();
2043
2078
  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"),
2079
+ resourceName: z.string().optional().describe("Apex class name for the REST resource"),
2080
+ className: z.string().optional().describe("Alias for resourceName"),
2045
2081
  urlMapping: z.string().min(1).describe("URL mapping, e.g. '/myresource/*' or '/accounts/:id'"),
2046
2082
  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"),
2083
+ methods: z.array(z.union([
2084
+ z.string().transform((s) => ({ httpMethod: s })),
2085
+ z.object({
2086
+ httpMethod: z.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).describe("HTTP method"),
2087
+ description: z.string().optional().describe("Method description"),
2088
+ apexCode: z.string().optional().describe("Method body code (returns empty implementation if omitted)"),
2089
+ }),
2090
+ ])).min(1).describe("HTTP methods to implement (array of method names or {httpMethod, description?, apexCode?} objects)"),
2052
2091
  }).strict();
2053
2092
  export const GetOrgLimitsSchema = z.object({
2054
2093
  filter: z.string().optional().describe("Optional filter string — return only limits whose name contains this text (e.g. 'Api', 'Storage', 'Scratch')"),
@@ -2061,37 +2100,43 @@ export const GetFlowErrorsSchema = z.object({
2061
2100
  export const GetApexTestResultsSchema = z.object({
2062
2101
  testRunId: z.string().optional().describe("Specific test run ID (from sf_run_apex_tests). Omit to get latest run."),
2063
2102
  className: z.string().optional().describe("Filter to a specific Apex test class"),
2064
- outcomeFilter: z.enum(["Pass","Fail","CompileFail","Skip","all"]).default("all").describe("Filter by outcome"),
2103
+ outcomeFilter: z.enum(["Pass", "Fail", "CompileFail", "Skip", "all"]).default("all").describe("Filter by outcome"),
2104
+ limit: z.number().int().min(1).max(2000).default(200).optional().describe("Maximum results to return"),
2065
2105
  }).strict();
2066
2106
  export const GetDeploymentHistorySchema = z.object({
2067
2107
  limit: z.number().int().default(10).describe("Maximum deployments to return"),
2068
- status: z.enum(["Succeeded","Failed","Pending","InProgress","Canceling","all"]).default("all").describe("Filter by deployment status"),
2108
+ status: z.enum(["Succeeded", "Failed", "Pending", "InProgress", "Canceling", "all"]).default("all").describe("Filter by deployment status"),
2069
2109
  }).strict();
2070
2110
  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"),
2111
+ agentApiName: z.string().optional().describe("Agentforce agent (Bot) API name"),
2112
+ agentName: z.string().optional().describe("Alias for agentApiName"),
2113
+ channelType: z.enum(["Messaging", "Chat", "Embedded", "Voice", "Web"]).describe("Channel type to configure"),
2073
2114
  channelName: z.string().min(1).describe("Existing channel API name (MessagingChannel for Messaging, LiveChatButton for Chat)"),
2074
- routingType: z.enum(["Queue","Agent","Bot"]).default("Bot").describe("Routing type — Bot routes to agent first, then escalates"),
2115
+ routingType: z.enum(["Queue", "Agent", "Bot"]).default("Bot").describe("Routing type — Bot routes to agent first, then escalates"),
2075
2116
  queueName: z.string().optional().describe("Queue name for escalation (recommended when routingType=Bot)"),
2117
+ label: z.string().optional().describe("Channel display label"),
2076
2118
  }).strict();
2077
2119
  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"),
2120
+ sourceAgentApiName: z.string().optional().describe("Source agent (Bot) API name to clone"),
2121
+ sourceAgentName: z.string().optional().describe("Alias for sourceAgentApiName"),
2122
+ newAgentApiName: z.string().optional().describe("New agent API name"),
2123
+ newAgentName: z.string().optional().describe("Alias for newAgentApiName"),
2124
+ newLabel: z.string().optional().describe("New agent display label"),
2081
2125
  includeTopics: z.boolean().default(true).describe("Clone the agent's topics (GenAiPlugins)"),
2082
2126
  includeActions: z.boolean().default(true).describe("Clone the agent's actions (GenAiFunctions) — requires includeTopics=true"),
2083
2127
  }).strict();
2084
2128
  export const ExportAgentSchema = z.object({
2085
- agentApiName: z.string().min(1).describe("Agent (Bot) API name to export"),
2129
+ agentApiName: z.string().optional().describe("Agent (Bot) API name to export"),
2130
+ agentName: z.string().optional().describe("Alias for agentApiName"),
2086
2131
  }).strict();
2087
2132
  export const ExportOmniStudioComponentSchema = z.object({
2088
- componentType: z.enum(["FlexCard","OmniScript","DataRaptor","IntegrationProcedure"]).describe("Component type to export"),
2133
+ componentType: z.enum(["FlexCard", "OmniScript", "DataRaptor", "IntegrationProcedure"]).describe("Component type to export"),
2089
2134
  componentName: z.string().min(1).describe("Component API name"),
2090
2135
  subType: z.string().optional().describe("Sub-type (required for OmniScript and IntegrationProcedure: the subType portion of the fullName)"),
2091
2136
  language: z.string().default("English").describe("Language (for OmniScript, e.g. 'English')"),
2092
2137
  }).strict();
2093
2138
  export const ImportOmniStudioComponentSchema = z.object({
2094
- componentType: z.enum(["FlexCard","OmniScript","DataRaptor","IntegrationProcedure"]).describe("Component type to import"),
2139
+ componentType: z.enum(["FlexCard", "OmniScript", "DataRaptor", "IntegrationProcedure"]).describe("Component type to import"),
2095
2140
  newName: z.string().min(1).describe("New API name for the imported component (must differ from source)"),
2096
2141
  jsonDefinition: z.string().min(1).describe("JSON string exported by sf_export_omnistudio_component"),
2097
2142
  activate: z.boolean().default(false).describe("Activate the component after import"),
@@ -2100,8 +2145,8 @@ export const CreateDocumentGenerationSchema = z.object({
2100
2145
  templateName: z.string().min(1).max(80).regex(/^[A-Za-z][A-Za-z0-9_]*$/).describe("Template API name"),
2101
2146
  label: z.string().min(1).describe("Template display label"),
2102
2147
  objectApiName: z.string().min(1).describe("Context object API name, e.g. 'Account'"),
2103
- templateType: z.enum(["Word","PDF","Excel"]).default("Word").describe("Output document format"),
2104
- dataSourceType: z.enum(["DataRaptor","IntegrationProcedure"]).default("DataRaptor").describe("Data source type"),
2148
+ templateType: z.enum(["Word", "PDF", "Excel"]).default("Word").describe("Output document format"),
2149
+ dataSourceType: z.enum(["DataRaptor", "IntegrationProcedure"]).default("DataRaptor").describe("Data source type"),
2105
2150
  dataSourceName: z.string().min(1).describe("DataRaptor or Integration Procedure API name to feed data"),
2106
2151
  description: z.string().optional().describe("Template description"),
2107
2152
  }).strict();