KosmoKrator

productivity

Salesforce CLI for AI Agents

Use the Salesforce CLI from KosmoKrator to call Salesforce tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

18 functions 10 read 8 write Manual OAuth token auth

Salesforce CLI Setup

Salesforce can be configured headlessly with `kosmokrator integrations:configure salesforce`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure salesforce --set access_token="$SALESFORCE_ACCESS_TOKEN" --set instance_url="$SALESFORCE_INSTANCE_URL" --enable --read allow --write ask --json
kosmokrator integrations:doctor salesforce --json
kosmokrator integrations:status --json

Credentials

Authentication type: Manual OAuth token oauth2_manual_token. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
access_token SALESFORCE_ACCESS_TOKEN Secret secret yes OAuth2 Access Token
instance_url SALESFORCE_INSTANCE_URL Text string yes Instance URL

Call Salesforce Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call salesforce.salesforce_create_lead '{
  "first_name": "example_first_name",
  "last_name": "example_last_name",
  "company": "example_company",
  "email": "example_email",
  "phone": "example_phone",
  "title": "example_title",
  "website": "example_website",
  "other_fields": "example_other_fields"
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:salesforce salesforce_create_lead '{
  "first_name": "example_first_name",
  "last_name": "example_last_name",
  "company": "example_company",
  "email": "example_email",
  "phone": "example_phone",
  "title": "example_title",
  "website": "example_website",
  "other_fields": "example_other_fields"
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs salesforce --json
kosmo integrations:docs salesforce.salesforce_create_lead --json
kosmo integrations:schema salesforce.salesforce_create_lead --json
kosmo integrations:search "Salesforce" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Salesforce.

salesforce.salesforce_create_lead

Write write

Create a new lead in Salesforce. Supports FirstName, LastName, Company, Email, Phone, Title, Website, and additional custom fields via other_fields. Returns the created lead ID and success status.

Parameters
first_name, last_name, company, email, phone, title, website, other_fields

Generic CLI call

kosmo integrations:call salesforce.salesforce_create_lead '{"first_name":"example_first_name","last_name":"example_last_name","company":"example_company","email":"example_email","phone":"example_phone","title":"example_title","website":"example_website","other_fields":"example_other_fields"}' --json

Provider shortcut

kosmo integrations:salesforce salesforce_create_lead '{"first_name":"example_first_name","last_name":"example_last_name","company":"example_company","email":"example_email","phone":"example_phone","title":"example_title","website":"example_website","other_fields":"example_other_fields"}' --json

salesforce.salesforce_get_lead

Read read

Retrieve a Salesforce lead by its ID. Returns the lead's fields, attributes, and associated data.

Parameters
id

Generic CLI call

kosmo integrations:call salesforce.salesforce_get_lead '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:salesforce salesforce_get_lead '{"id":"example_id"}' --json

salesforce.salesforce_update_lead

Write write

Update an existing Salesforce lead by ID. Supports FirstName, LastName, Company, Email, Phone, and additional custom fields via other_fields. Returns success confirmation on completion.

Parameters
id, first_name, last_name, company, email, phone, other_fields

Generic CLI call

kosmo integrations:call salesforce.salesforce_update_lead '{"id":"example_id","first_name":"example_first_name","last_name":"example_last_name","company":"example_company","email":"example_email","phone":"example_phone","other_fields":"example_other_fields"}' --json

Provider shortcut

kosmo integrations:salesforce salesforce_update_lead '{"id":"example_id","first_name":"example_first_name","last_name":"example_last_name","company":"example_company","email":"example_email","phone":"example_phone","other_fields":"example_other_fields"}' --json

salesforce.salesforce_create_contact

Write write

Create a new contact in Salesforce. Supports FirstName, LastName, Email, Phone, AccountId, Title, and additional custom fields via other_fields. Returns the created contact ID and success status.

Parameters
first_name, last_name, email, phone, account_id, title, other_fields

Generic CLI call

kosmo integrations:call salesforce.salesforce_create_contact '{"first_name":"example_first_name","last_name":"example_last_name","email":"example_email","phone":"example_phone","account_id":"example_account_id","title":"example_title","other_fields":"example_other_fields"}' --json

Provider shortcut

kosmo integrations:salesforce salesforce_create_contact '{"first_name":"example_first_name","last_name":"example_last_name","email":"example_email","phone":"example_phone","account_id":"example_account_id","title":"example_title","other_fields":"example_other_fields"}' --json

salesforce.salesforce_get_contact

Read read

Retrieve a Salesforce contact by its ID. Returns the contact's fields, attributes, and associated data.

Parameters
id

Generic CLI call

kosmo integrations:call salesforce.salesforce_get_contact '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:salesforce salesforce_get_contact '{"id":"example_id"}' --json

salesforce.salesforce_create_account

Write write

Create a new account in Salesforce. Supports Name, Website, Phone, Industry, BillingCity, BillingCountry, and additional custom fields via other_fields. Returns the created account ID and success status.

Parameters
name, website, phone, industry, billing_city, billing_country, other_fields

Generic CLI call

kosmo integrations:call salesforce.salesforce_create_account '{"name":"example_name","website":"example_website","phone":"example_phone","industry":"example_industry","billing_city":"example_billing_city","billing_country":"example_billing_country","other_fields":"example_other_fields"}' --json

Provider shortcut

kosmo integrations:salesforce salesforce_create_account '{"name":"example_name","website":"example_website","phone":"example_phone","industry":"example_industry","billing_city":"example_billing_city","billing_country":"example_billing_country","other_fields":"example_other_fields"}' --json

salesforce.salesforce_get_account

Read read

Retrieve a Salesforce account by its ID. Returns the account's fields, attributes, and associated data.

Parameters
id

Generic CLI call

kosmo integrations:call salesforce.salesforce_get_account '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:salesforce salesforce_get_account '{"id":"example_id"}' --json

salesforce.salesforce_update_account

Write write

Update an existing Salesforce account by ID. Supports Name, Website, Phone, and additional custom fields via other_fields. Returns success confirmation on completion.

Parameters
id, name, website, phone, other_fields

Generic CLI call

kosmo integrations:call salesforce.salesforce_update_account '{"id":"example_id","name":"example_name","website":"example_website","phone":"example_phone","other_fields":"example_other_fields"}' --json

Provider shortcut

kosmo integrations:salesforce salesforce_update_account '{"id":"example_id","name":"example_name","website":"example_website","phone":"example_phone","other_fields":"example_other_fields"}' --json

salesforce.salesforce_create_opportunity

Write write

Create a new opportunity in Salesforce. Supports Name, Amount, StageName, CloseDate, AccountId, and Probability. Returns the created opportunity ID and success status.

Parameters
name, amount, stage_name, close_date, account_id, probability

Generic CLI call

kosmo integrations:call salesforce.salesforce_create_opportunity '{"name":"example_name","amount":1,"stage_name":"example_stage_name","close_date":"example_close_date","account_id":"example_account_id","probability":1}' --json

Provider shortcut

kosmo integrations:salesforce salesforce_create_opportunity '{"name":"example_name","amount":1,"stage_name":"example_stage_name","close_date":"example_close_date","account_id":"example_account_id","probability":1}' --json

salesforce.salesforce_get_opportunity

Read read

Retrieve a Salesforce opportunity by its ID. Returns the opportunity's fields, attributes, and associated data.

Parameters
id

Generic CLI call

kosmo integrations:call salesforce.salesforce_get_opportunity '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:salesforce salesforce_get_opportunity '{"id":"example_id"}' --json

salesforce.salesforce_query

Read read

Execute a SOQL (Salesforce Object Query Language) query. Use SOQL to search records in Salesforce. Example: SELECT Id, Name FROM Account LIMIT 10 Returns query results with total size and records.

Parameters
soql

Generic CLI call

kosmo integrations:call salesforce.salesforce_query '{"soql":"example_soql"}' --json

Provider shortcut

kosmo integrations:salesforce salesforce_query '{"soql":"example_soql"}' --json

salesforce.salesforce_describe_object

Read read

Get metadata for a Salesforce object type. Returns field definitions, relationships, record types, and other metadata. Example object types: Account, Contact, Lead, Opportunity, Case, Task, User.

Parameters
object_type

Generic CLI call

kosmo integrations:call salesforce.salesforce_describe_object '{"object_type":"example_object_type"}' --json

Provider shortcut

kosmo integrations:salesforce salesforce_describe_object '{"object_type":"example_object_type"}' --json

salesforce.salesforce_list_objects

Read read

List all available Salesforce objects (standard and custom). Returns object names, labels, and key prefixes.

Parameters
none

Generic CLI call

kosmo integrations:call salesforce.salesforce_list_objects '{}' --json

Provider shortcut

kosmo integrations:salesforce salesforce_list_objects '{}' --json

salesforce.salesforce_create_task

Write write

Create a new task in Salesforce. Supports Subject, Description, Status, Priority, WhoId (contact/lead), WhatId (account/opportunity), and ActivityDate. Returns the created task ID and success status.

Parameters
subject, description, status, priority, who_id, what_id, activity_date

Generic CLI call

kosmo integrations:call salesforce.salesforce_create_task '{"subject":"example_subject","description":"example_description","status":"example_status","priority":"example_priority","who_id":"example_who_id","what_id":"example_what_id","activity_date":"example_activity_date"}' --json

Provider shortcut

kosmo integrations:salesforce salesforce_create_task '{"subject":"example_subject","description":"example_description","status":"example_status","priority":"example_priority","who_id":"example_who_id","what_id":"example_what_id","activity_date":"example_activity_date"}' --json

salesforce.salesforce_create_case

Write write

Create a new case in Salesforce. Supports Subject, Description, Status, Priority, Origin, ContactId, and AccountId. Returns the created case ID and success status.

Parameters
subject, description, status, priority, origin, contact_id, account_id

Generic CLI call

kosmo integrations:call salesforce.salesforce_create_case '{"subject":"example_subject","description":"example_description","status":"example_status","priority":"example_priority","origin":"example_origin","contact_id":"example_contact_id","account_id":"example_account_id"}' --json

Provider shortcut

kosmo integrations:salesforce salesforce_create_case '{"subject":"example_subject","description":"example_description","status":"example_status","priority":"example_priority","origin":"example_origin","contact_id":"example_contact_id","account_id":"example_account_id"}' --json

salesforce.salesforce_list_recent

Read read

List recently accessed items in Salesforce. Returns recently viewed or modified records across all object types. Optionally specify a limit to control the number of items returned.

Parameters
limit

Generic CLI call

kosmo integrations:call salesforce.salesforce_list_recent '{"limit":1}' --json

Provider shortcut

kosmo integrations:salesforce salesforce_list_recent '{"limit":1}' --json

salesforce.salesforce_get_user

Read read

Retrieve a Salesforce user by their ID. Returns the user's name, email, profile, role, and other fields.

Parameters
id

Generic CLI call

kosmo integrations:call salesforce.salesforce_get_user '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:salesforce salesforce_get_user '{"id":"example_id"}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

salesforce.salesforce_create_lead

Create a new lead in Salesforce. Supports FirstName, LastName, Company, Email, Phone, Title, Website, and additional custom fields via other_fields. Returns the created lead ID and success status.

Operation
Write write
Schema command
kosmo integrations:schema salesforce.salesforce_create_lead --json
ParameterTypeRequiredDescription
first_name string no Lead first name.
last_name string yes Lead last name.
company string yes Lead company name.
email string no Lead email address.
phone string no Lead phone number.
title string no Lead job title.
website string no Lead website URL.
other_fields object no Additional custom fields as key-value pairs to merge into the request body.

salesforce.salesforce_get_lead

Retrieve a Salesforce lead by its ID. Returns the lead's fields, attributes, and associated data.

Operation
Read read
Schema command
kosmo integrations:schema salesforce.salesforce_get_lead --json
ParameterTypeRequiredDescription
id string yes Salesforce lead ID (18 or 15 character).

salesforce.salesforce_update_lead

Update an existing Salesforce lead by ID. Supports FirstName, LastName, Company, Email, Phone, and additional custom fields via other_fields. Returns success confirmation on completion.

Operation
Write write
Schema command
kosmo integrations:schema salesforce.salesforce_update_lead --json
ParameterTypeRequiredDescription
id string yes Salesforce lead ID to update.
first_name string no Lead first name.
last_name string no Lead last name.
company string no Lead company name.
email string no Lead email address.
phone string no Lead phone number.
other_fields object no Additional custom fields as key-value pairs to merge into the request body.

salesforce.salesforce_create_contact

Create a new contact in Salesforce. Supports FirstName, LastName, Email, Phone, AccountId, Title, and additional custom fields via other_fields. Returns the created contact ID and success status.

Operation
Write write
Schema command
kosmo integrations:schema salesforce.salesforce_create_contact --json
ParameterTypeRequiredDescription
first_name string no Contact first name.
last_name string yes Contact last name.
email string no Contact email address.
phone string no Contact phone number.
account_id string no Salesforce Account ID to associate the contact with.
title string no Contact job title.
other_fields object no Additional custom fields as key-value pairs to merge into the request body.

salesforce.salesforce_get_contact

Retrieve a Salesforce contact by its ID. Returns the contact's fields, attributes, and associated data.

Operation
Read read
Schema command
kosmo integrations:schema salesforce.salesforce_get_contact --json
ParameterTypeRequiredDescription
id string yes Salesforce contact ID (18 or 15 character).

salesforce.salesforce_create_account

Create a new account in Salesforce. Supports Name, Website, Phone, Industry, BillingCity, BillingCountry, and additional custom fields via other_fields. Returns the created account ID and success status.

Operation
Write write
Schema command
kosmo integrations:schema salesforce.salesforce_create_account --json
ParameterTypeRequiredDescription
name string yes Account name.
website string no Account website URL.
phone string no Account phone number.
industry string no Account industry (e.g. Technology, Finance).
billing_city string no Billing address city.
billing_country string no Billing address country.
other_fields object no Additional custom fields as key-value pairs to merge into the request body.

salesforce.salesforce_get_account

Retrieve a Salesforce account by its ID. Returns the account's fields, attributes, and associated data.

Operation
Read read
Schema command
kosmo integrations:schema salesforce.salesforce_get_account --json
ParameterTypeRequiredDescription
id string yes Salesforce account ID (18 or 15 character).

salesforce.salesforce_update_account

Update an existing Salesforce account by ID. Supports Name, Website, Phone, and additional custom fields via other_fields. Returns success confirmation on completion.

Operation
Write write
Schema command
kosmo integrations:schema salesforce.salesforce_update_account --json
ParameterTypeRequiredDescription
id string yes Salesforce account ID to update.
name string no Account name.
website string no Account website URL.
phone string no Account phone number.
other_fields object no Additional custom fields as key-value pairs to merge into the request body.

salesforce.salesforce_create_opportunity

Create a new opportunity in Salesforce. Supports Name, Amount, StageName, CloseDate, AccountId, and Probability. Returns the created opportunity ID and success status.

Operation
Write write
Schema command
kosmo integrations:schema salesforce.salesforce_create_opportunity --json
ParameterTypeRequiredDescription
name string yes Opportunity name.
amount number no Opportunity amount (numeric).
stage_name string yes Sales stage (e.g. Prospecting, Qualification, Closed Won).
close_date string yes Expected close date (YYYY-MM-DD).
account_id string no Salesforce Account ID to associate the opportunity with.
probability number no Win probability as a percentage (0-100).

salesforce.salesforce_get_opportunity

Retrieve a Salesforce opportunity by its ID. Returns the opportunity's fields, attributes, and associated data.

Operation
Read read
Schema command
kosmo integrations:schema salesforce.salesforce_get_opportunity --json
ParameterTypeRequiredDescription
id string yes Salesforce opportunity ID (18 or 15 character).

salesforce.salesforce_query

Execute a SOQL (Salesforce Object Query Language) query. Use SOQL to search records in Salesforce. Example: SELECT Id, Name FROM Account LIMIT 10 Returns query results with total size and records.

Operation
Read read
Schema command
kosmo integrations:schema salesforce.salesforce_query --json
ParameterTypeRequiredDescription
soql string yes SOQL query string (e.g. SELECT Id, Name FROM Account LIMIT 10).

salesforce.salesforce_describe_object

Get metadata for a Salesforce object type. Returns field definitions, relationships, record types, and other metadata. Example object types: Account, Contact, Lead, Opportunity, Case, Task, User.

Operation
Read read
Schema command
kosmo integrations:schema salesforce.salesforce_describe_object --json
ParameterTypeRequiredDescription
object_type string yes Salesforce object API name (e.g. Account, Contact, Lead).

salesforce.salesforce_list_objects

List all available Salesforce objects (standard and custom). Returns object names, labels, and key prefixes.

Operation
Read read
Schema command
kosmo integrations:schema salesforce.salesforce_list_objects --json
ParameterTypeRequiredDescription
No parameters.

salesforce.salesforce_create_task

Create a new task in Salesforce. Supports Subject, Description, Status, Priority, WhoId (contact/lead), WhatId (account/opportunity), and ActivityDate. Returns the created task ID and success status.

Operation
Write write
Schema command
kosmo integrations:schema salesforce.salesforce_create_task --json
ParameterTypeRequiredDescription
subject string yes Task subject/title.
description string no Task description or body.
status string no Task status (e.g. Not Started, In Progress, Completed).
priority string no Task priority (e.g. Normal, High, Low).
who_id string no ID of the related Contact or Lead.
what_id string no ID of the related Account, Opportunity, or other object.
activity_date string no Due date for the task (YYYY-MM-DD).

salesforce.salesforce_create_case

Create a new case in Salesforce. Supports Subject, Description, Status, Priority, Origin, ContactId, and AccountId. Returns the created case ID and success status.

Operation
Write write
Schema command
kosmo integrations:schema salesforce.salesforce_create_case --json
ParameterTypeRequiredDescription
subject string yes Case subject/title.
description string no Case description or details.
status string no Case status (e.g. New, Working, Escalated, Closed).
priority string no Case priority (e.g. Low, Medium, High, Critical).
origin string no Case origin (e.g. Web, Email, Phone).
contact_id string no ID of the related Contact.
account_id string no ID of the related Account.

salesforce.salesforce_list_recent

List recently accessed items in Salesforce. Returns recently viewed or modified records across all object types. Optionally specify a limit to control the number of items returned.

Operation
Read read
Schema command
kosmo integrations:schema salesforce.salesforce_list_recent --json
ParameterTypeRequiredDescription
limit integer no Maximum number of items to return (default 25).

salesforce.salesforce_get_user

Retrieve a Salesforce user by their ID. Returns the user's name, email, profile, role, and other fields.

Operation
Read read
Schema command
kosmo integrations:schema salesforce.salesforce_get_user --json
ParameterTypeRequiredDescription
id string yes Salesforce user ID (18 or 15 character).

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.