Skip to main content
Glama
advancedcommunities

Salesforce MCP Server

query_records

Read-onlyIdempotent

Retrieve records from a single Salesforce object using structured field conditions, returning JSON results for precise SOQL-style data queries.

Instructions

Query records from a SINGLE Salesforce object using structured field conditions. Use this for precise queries on ONE object with specific field criteria (e.g., Status = 'Open', Amount > 1000). NOT for text searches across multiple objects - use search_records for that. This executes SOQL queries with SELECT, WHERE, ORDER BY, and LIMIT clauses on a single SObject. The results are returned in JSON format. IMPORTANT: Always execute the sobject_list tool first to understand which objects are available in the org, and optionally execute sobject_describe for the specific SObject to understand its fields and structure before querying.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
recordsYes
targetOrgYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.7.0

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint, idempotentHint, openWorldHint, and destructiveHint=false, so the safety profile is covered. The description adds real context beyond that: it discloses that SOQL SELECT/WHERE/ORDER BY/LIMIT are executed and that results come back as JSON. It does not mention pagination or query limits, which keeps it from a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads the core purpose and the exclusion before the implementation detail. Some redundancy – the caps-lock SINGLE/ONE/IMPORTANT and the SOQL clause sentence restate earlier content – but every sentence is functional.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists so return values need not be explained, and annotations cover the safety profile. The description supplies the routing, prerequisites, and query-capability context an agent needs. Minor gap: no mention of result limits or default-org resolution for targetOrg.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is reported at 0%, so the description must carry parameter meaning. It does convey the WHERE/ORDER BY/LIMIT clause semantics and the prerequisite for knowing the SObject, but it says nothing about targetOrg (default org behavior) or the shape of selectClause beyond what's obvious. Partial compensation only.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource (query records from a SINGLE Salesforce object) with scope and gives concrete examples of conditions. It explicitly names the sibling it is not (search_records for cross-object text search), so the agent can disambiguate without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit when-to-use (precise queries on one object with field criteria), when-not (text searches across multiple objects), the named alternative, and a sequencing prerequisite (run sobject_list first, optionally sobject_describe). Nothing is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.