Skip to main content
Glama
semwalajay83-sem

salesforce-metadata-mcp

Query Records (SOQL)

sf_query_records
Read-onlyIdempotent

Execute SOQL queries to retrieve Salesforce records, check for existing data before creating, or verify changes. Supports aggregate queries and enforces a configurable row limit.

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").

Row cap: 'limit' defaults to 200 and is a ceiling, not a hint. If the SOQL carries its own LIMIT the smaller of the two applies, so a LIMIT in the query can tighten the cap but never raise it. When rows are cut off the response sets truncated: true and reports appliedLimit and limitSource, so a capped result is never mistaken for a complete one.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum records to return (default 200). Acts as a ceiling: if the SOQL contains its own LIMIT, the smaller of the two wins, so a LIMIT in the query can tighten this but never raise it. The response reports appliedLimit, limitSource and truncated.
queryYesFull SOQL query string, e.g. 'SELECT Id, Name FROM Account WHERE Industry = \'Technology\' LIMIT 10'

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv3.2.0
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum records to return (default 200)"New value: +"Maximum records to return (default 200). Acts as a ceiling: if the SOQL contains its own LIMIT, the smaller of the two wins, so a LIMIT in the query can tighten this but never raise it. The response reports appliedLimit, limitSource and truncated."
  2. First observedv2.8.5

TDQS

A4.7/5.0
Behavior5/5

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

Beyond the annotations, which already indicate read-only, idempotent, non-destructive behavior, the description adds valuable behavioral details: aggregate query support, aggregate result field keys like 'expr0', and precise row-cap/truncation semantics. This meaningfully improves an agent's ability to interpret responses correctly.

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 well-organized and front-loaded: purpose, usage, aggregate behavior, then limit semantics. Every paragraph carries essential information, and there is no filler or repetition that does not serve the agent.

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

Completeness5/5

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

For a two-parameter read-only tool with no output schema, the description is complete: it explains expected return values for normal queries, how aggregates come back, and what happens when results are truncated. An agent has enough context to invoke it correctly and interpret the response.

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 description coverage is 100%, so the baseline is 3. The description adds value beyond the schema by providing a full SOQL example, explaining aggregate results, and reinforcing the limit-as-ceiling rule. This pushes it above baseline.

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 and resource: 'Executes a SOQL query against the org and returns matching records.' This clearly distinguishes the tool from metadata-oriented siblings like sf_list_objects and sf_describe_object, and the title reinforces the SOQL scope.

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?

It explicitly states when to use the tool: 'Use for reading data, checking existing records before creating, or verifying changes.' This gives clear context, though it does not explicitly name alternatives or exclusion cases, so it stops short of a 5.

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