import { createLogger } from '@sim/logger' import type { SalesforceCreateCustomObjectParams, SalesforceCreateCustomObjectResponse, } from '@/tools/salesforce/types' import { CUSTOM_OBJECT_CREATE_OUTPUT_PROPERTIES } from '@/tools/salesforce/types' import { extractErrorMessage, getInstanceUrl, toCustomApiName } from '@/tools/salesforce/utils' import type { ToolConfig } from '@/tools/types' const logger = createLogger('SalesforceCreateCustomObject') /** * Create a custom object via the Tooling API. The object is created with a * Text Name field and deployed immediately. Custom fields can then be added * with the Create Custom Field tool. * @see https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_customobject.htm */ export const salesforceCreateCustomObjectTool: ToolConfig< SalesforceCreateCustomObjectParams, SalesforceCreateCustomObjectResponse > = { id: 'salesforce_create_custom_object', name: 'Create Custom Object in Salesforce', description: 'Create a custom object in Salesforce using the Tooling API', version: '1.0.0', oauth: { required: true, provider: 'salesforce', }, params: { accessToken: { type: 'string', required: true, visibility: 'hidden' }, idToken: { type: 'string', required: false, visibility: 'hidden' }, instanceUrl: { type: 'string', required: false, visibility: 'hidden' }, objectName: { type: 'string', required: true, visibility: 'user-or-llm', description: 'API name of the new object; the __c suffix is added automatically (e.g., Project)', }, label: { type: 'string', required: true, visibility: 'user-or-llm', description: 'Singular display label for the object (e.g., Project)', }, pluralLabel: { type: 'string', required: true, visibility: 'user-or-llm', description: 'Plural display label for the object (e.g., Projects)', }, nameFieldLabel: { type: 'string', required: false, visibility: 'user-or-llm', description: 'Label for the standard Name field (defaults to "