Skip to main content
Glama
JereSalguero30

Salesforce MCP Server

salesforce_query_records

Query Salesforce records from any object using SOQL, including parent-child and child-parent relationships. Specify fields, filters, sorting, and limits to retrieve exactly the data you need.

Instructions

Query records from any Salesforce object using SOQL, including relationship queries.

NOTE: For queries with GROUP BY, aggregate functions (COUNT, SUM, AVG, etc.), or HAVING clauses, use salesforce_aggregate_query instead.

Examples:

  1. Parent-to-child query (e.g., Account with Contacts):

    • objectName: "Account"

    • fields: ["Name", "(SELECT Id, FirstName, LastName FROM Contacts)"]

  2. Child-to-parent query (e.g., Contact with Account details):

    • objectName: "Contact"

    • fields: ["FirstName", "LastName", "Account.Name", "Account.Industry"]

  3. Multiple level query (e.g., Contact -> Account -> Owner):

    • objectName: "Contact"

    • fields: ["Name", "Account.Name", "Account.Owner.Name"]

  4. Related object filtering:

    • objectName: "Contact"

    • fields: ["Name", "Account.Name"]

    • whereClause: "Account.Industry = 'Technology'"

Note: When using relationship fields:

  • Use dot notation for parent relationships (e.g., "Account.Name")

  • Use subqueries in parentheses for child relationships (e.g., "(SELECT Id FROM Contacts)")

  • Custom relationship fields end in "__r" (e.g., "CustomObject__r.Name")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of records to return
fieldsYesList of fields to retrieve, including relationship fields
orderByNoORDER BY clause, can include fields from related objects
objectNameYesAPI name of the object to query
whereClauseNoWHERE clause, can include conditions on related objects
Behavior3/5

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

No annotations are provided, so the description carries the burden of behavioral transparency. It does disclose relationship query nuances (dot notation, subqueries, __r suffixes) but does not explicitly state whether the operation is read-only, what permissions are needed, or any limits/timeout behavior. 'Query' implies a read, but not all behavioral traits are covered.

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

Conciseness5/5

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

The description is long but every section earns its place: a clear purpose sentence, a critical exclusion note, four varied examples, and a concise summary of relationship field rules. The structure front-loads the main idea and then layers detail logically. Nothing is redundant or filler.

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?

For a moderately complex tool with no output schema and no annotations, the description covers essential query construction, relationship semantics, and aggregate query alternatives. It does not explicitly describe the shape of the returned records, but that is generally implicit for a query tool. The examples and notes provide enough context to use the tool correctly.

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

Parameters5/5

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

While schema coverage is 100% (baseline 3), the description adds substantial meaning beyond schema property descriptions. It provides detailed multi-level query examples for fields, explains how to construct relationship queries in whereClause, and introduces conventions like dot notation and subqueries that are not captured in the schema. This is exceptional parameter-level guidance.

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?

The description opens with a specific verb-resource-scope statement: 'Query records from any Salesforce object using SOQL, including relationship queries.' It clearly distinguishes itself from sibling salesforce_aggregate_query by explicitly naming the alternative for aggregate queries, and from other tools like describe or search.

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?

The description explicitly states when NOT to use this tool: 'For queries with GROUP BY, aggregate functions (COUNT, SUM, AVG, etc.), or HAVING clauses, use salesforce_aggregate_query instead.' This directly guides tool selection among siblings. Examples also clarify use cases for parent-child and child-parent queries.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/JereSalguero30/mcp-server-salesforce'

If you have feedback or need assistance with the MCP directory API, please join our Discord server