Skip to main content
Glama
smn2gnt

MCP Salesforce Connector

by smn2gnt

run_soql_query

Execute SOQL queries to retrieve Salesforce data efficiently using the MCP Salesforce Connector, enabling direct interaction with Salesforce records for streamlined data access.

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 it using the Salesforce client's query_all method, and returns the results as formatted JSON text content.
    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)}", ) ]
  • The registration of the 'run_soql_query' tool in the list_tools handler, including its name, description, and input schema requiring a 'query' string.
    types.Tool( 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"], }, ),
  • The JSON schema definition for the input arguments of the 'run_soql_query' tool, specifying an object with a required 'query' string property.
    "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/smn2gnt/MCP-Salesforce'

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