Skip to main content
Glama

run_soql_query

Execute SOQL queries to retrieve data from Salesforce. Input a SOQL query string to interact directly with Salesforce data via the salesforce-mcp server.

Instructions

Executes a SOQL query against Salesforce

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe SOQL query to execute

Implementation Reference

  • The handler logic within the call_tool function that parses the query argument, executes sf_client.sf.query_all(query), and returns the JSON-formatted results as TextContent.
    if name == "run_soql_query": query = arguments.get("query") if not query: raise ValueError("Missing 'query' argument") results = sf_client.sf.query_all(query) return [ types.TextContent( type="text", text=f"SOQL Query Results (JSON):\n{json.dumps(results, indent=2)}", ) ]
  • Tool registration in the list_tools handler, defining the name, description, and input schema requiring a 'query' string.
    name="run_soql_query", description="Executes a SOQL query against Salesforce", inputSchema={ "type": "object", "properties": { "query": { "type": "string", "description": "The SOQL query to execute", }, }, "required": ["query"], }, ),
  • JSON schema for the tool input, specifying an object with a required 'query' string property.
    inputSchema={ "type": "object", "properties": { "query": { "type": "string", "description": "The SOQL query to execute", }, }, "required": ["query"], },

Other Tools

Related 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/leilaabdel/MCP-Salesforce'

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