All tools

Query records with SOQL

Runs a SOQL query and returns the matching records with the fields it selects.

View on GitHub
Updated Sep 27, 2026Available asMCPCLIAPI

Description

Pass the query in `q`, for example `SELECT Id, Name, Industry FROM Account WHERE Industry = 'Technology' LIMIT 100`. One response holds up to 2,000 records; when there are more, `nextRecordsUrl` fetches the next batch.

query-records.md

Query records with SOQL

Runs a SOQL query and returns the matching records with the fields it selects.

Pass the query in q, for example SELECT Id, Name, Industry FROM Account WHERE Industry = 'Technology' LIMIT 100. One response holds up to 2,000 records; when there are more, nextRecordsUrl fetches the next batch.

Set up

Use the first option your agent supports.

MCP (official, remote)

Add this server to your agent's MCP settings, then sign in when asked.

{ "mcpServers": { "salesforce": { "url": "https://api.salesforce.com/platform/mcp/v1/platform/sobject-mutations" } } }

Call the MCP tool soqlQuery.

Server URL: https://api.salesforce.com/platform/mcp/v1/platform/sobject-mutations

CLI (official)

Install the command, then confirm it runs.

npm install @salesforce/cli --global
sf --version

Run sf data query.

API (official)

Before doing anything else, make one read-only call to confirm access.

Rules

  • Ask the user before anything that sends messages, costs money, or changes data.
  • Never print API keys.

Built from these files in the repository

The layout and the rules come from lib/catalog/render-markdown.ts, the set-up wording from lib/catalog/render-access.ts.

Ways in

RouteSourceCallRequiredDocs
MCPOfficial · remotesoqlQueryOAuthDocs
CLIOfficialsf data queryOAuthDocs
APIOfficialGET /services/data/vXX.X/queryOAuthDocs

Workflows using Query records with SOQL

No workflows yet
No published workflow uses Query records with SOQL yet.