Query Records (SOQL)
sf_query_recordsExecute SOQL queries against Salesforce to retrieve matching records, including aggregate results, for reading data, checking record existence before creation, or verifying changes.
Instructions
Executes a SOQL query against the org and returns matching records. Provide the full SOQL string in the query param. Use for reading data, checking existing records before creating, or verifying changes.
Supports aggregate queries — GROUP BY with COUNT(), SUM(), AVG(), MAX(), MIN(), e.g.: 'SELECT StageName, COUNT(Id), SUM(Amount) FROM Opportunity GROUP BY StageName' Aggregate results come back as regular records with the aggregate expressions as field keys (e.g. "expr0").
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum records to return (default 200) | |
| query | Yes | Full SOQL query string, e.g. 'SELECT Id, Name FROM Account WHERE Industry = \'Technology\' LIMIT 10' |