Skip to main content
Glama
boejucci

Salesforce MCP Server (Extended)

by boejucci

salesforce_query_records

Query records from any Salesforce object using SOQL, including parent-to-child and child-to-parent relationship queries.

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
objectNameYesAPI name of the object to query
fieldsYesList of fields to retrieve, including relationship fields
whereClauseNoWHERE clause, can include conditions on related objects
orderByNoORDER BY clause, can include fields from related objects
limitNoMaximum number of records to return
Behavior3/5

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

No annotations are provided, so the description must fully cover behavioral traits. It implies a read operation but does not explicitly state that it only queries and does not modify data, nor does it mention permissions or side effects. This is adequate but leaves ambiguity for the agent.

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?

The description is front-loaded with purpose and a key note, then provides practical examples without unnecessary fluff. It is slightly long due to examples, but each example earns its place by clarifying complex relationship queries.

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?

Given no output schema, the description adequately explains query construction, including relationship patterns. It covers essential aspects like WHERE on related objects and ORDER BY. However, it could mention default limits or error handling for completeness.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3. The description adds value by providing detailed examples and notes on relationship field syntax (dot notation, subqueries, custom relationship fields ending in '__r'), which clarify parameter usage beyond the schema definitions.

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 clearly states 'Query records from any Salesforce object using SOQL, including relationship queries,' specifying the verb, resource, and capability. It distinguishes itself from a sibling tool (salesforce_aggregate_query) by noting when to use the alternative for aggregate queries.

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

Usage Guidelines4/5

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

The description explicitly tells when to use salesforce_aggregate_query instead (for GROUP BY, aggregates, HAVING). However, it lacks guidance on when to prefer other sibling tools like salesforce_search_objects or salesforce_describe_object, which could lead to confusion in broader context.

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/boejucci/mcp-server-salesforce'

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