Package com.tnsai.tools.crm
Class SalesforceTools
java.lang.Object
com.tnsai.tools.crm.SalesforceTools
Function-shape Salesforce CRM tools — SOQL query + SOSL search + sObject
read via the Salesforce REST API. Replaces the Salesforce half of the
legacy
UnifiedCRMTool (the HubSpot half was migrated in
HubSpotTools, batch 29).
| Method | Endpoint | Idempotent |
|---|---|---|
salesforceQuery(java.lang.String) | GET /services/data/v59.0/query?q=<SOQL> | true |
salesforceSearch(java.lang.String) | GET /services/data/v59.0/search?q=<SOSL> | true |
salesforceGetSObject(java.lang.String, java.lang.String) | GET /services/data/v59.0/sobjects/{type}/{id} | true |
Salesforce uses per-org instance URLs (e.g.
https://yourcorp.my.salesforce.com). Auth is OAuth2 bearer token
(use the JWT bearer flow for server-to-server, or password flow for dev).
Requires SALESFORCE_INSTANCE_URL + SALESFORCE_ACCESS_TOKEN.
API version pinned to v59.0 for response-shape stability across
Salesforce releases.
- Since:
- 0.5.7 (Phase 2 batch 31b — built-in tool migration to function shape, see #188)
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor — picks SALESFORCE_INSTANCE_URL + SALESFORCE_ACCESS_TOKEN from env.SalesforceTools(String instanceUrl, String accessToken) Explicit-credentials constructor.SalesforceTools(String instanceUrl, String accessToken, okhttp3.OkHttpClient http, com.fasterxml.jackson.databind.ObjectMapper mapper) Full constructor for tests / shared HTTP. -
Method Summary
Modifier and TypeMethodDescriptionsalesforceGetSObject(String type, String id) salesforceQuery(String soql) salesforceSearch(String sosl)
-
Constructor Details
-
SalesforceTools
public SalesforceTools()Default constructor — picks SALESFORCE_INSTANCE_URL + SALESFORCE_ACCESS_TOKEN from env. -
SalesforceTools
Explicit-credentials constructor. -
SalesforceTools
public SalesforceTools(String instanceUrl, String accessToken, okhttp3.OkHttpClient http, com.fasterxml.jackson.databind.ObjectMapper mapper) Full constructor for tests / shared HTTP.
-
-
Method Details
-
salesforceQuery
@Tool(name="salesforce_query", description="Run a SOQL query against the Salesforce org and return the raw JSON response (records under \"records\"). Example: \"SELECT Id, Name, Industry FROM Account WHERE Industry = \'Technology\' LIMIT 10\". Requires SALESFORCE_INSTANCE_URL + SALESFORCE_ACCESS_TOKEN.", keywords={"salesforce","soql","query","crm"}, idempotent=true) public String salesforceQuery(@ToolParam(description="SOQL query string") String soql) throws IOException - Throws:
IOException
-
salesforceSearch
@Tool(name="salesforce_search", description="Run a SOSL (Salesforce Object Search Language) search across multiple sObject types. Example: \"FIND {acme} IN ALL FIELDS RETURNING Account(Id, Name), Contact(Id, Email)\". Returns the raw JSON.", keywords={"salesforce","sosl","search","crm","fulltext"}, idempotent=true) public String salesforceSearch(@ToolParam(description="SOSL search string") String sosl) throws IOException - Throws:
IOException
-
salesforceGetSObject
@Tool(name="salesforce_get_sobject", description="Fetch a single Salesforce sObject by type + id (e.g. {type=\"Account\", id=\"001\u2026\"}). Returns the raw JSON with all fields the access token can read.", keywords={"salesforce","sobject","get","account","contact","lead"}, idempotent=true) public String salesforceGetSObject(@ToolParam(description="sObject type (e.g. \"Account\", \"Contact\", \"Lead\")") String type, @ToolParam(description="Salesforce id (15- or 18-char)") String id) throws IOException - Throws:
IOException
-