Skip to main content
Glama
ampcome-mcps

MCP Salesforce Connector

by ampcome-mcps

apex_execute

Execute custom Apex REST endpoints to interact with Salesforce data and business logic through HTTP methods like GET, POST, PATCH, and DELETE.

Instructions

Executes an Apex REST request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesThe Apex REST endpoint to call (e.g., '/MyApexClass')
methodNoThe HTTP method (default: 'GET')GET
dataNoData for POST/PATCH requests

Implementation Reference

  • Handler function for 'apex_execute' tool. Extracts action, method, and data from arguments, validates, connects to Salesforce if needed, executes the Apex REST request using sf_client.sf.apexecute, and returns the JSON results.
    elif name == "apex_execute": action = arguments.get("action") method = arguments.get("method", "GET") data = arguments.get("data") if not action: raise ValueError("Missing 'action' argument") if not sf_client.sf: raise ValueError("Salesforce connection not established.") results = sf_client.sf.apexecute(action, method=method, data=data) return [ types.TextContent( type="text", text=f"Apex Execute Result (JSON):\n{json.dumps(results, indent=2)}", ) ]
  • Registration of the 'apex_execute' tool in the list_tools handler, including its name, description, and input schema definition for action, method, and data parameters.
    types.Tool( name="apex_execute", description="Executes an Apex REST request", inputSchema={ "type": "object", "properties": { "action": { "type": "string", "description": "The Apex REST endpoint to call (e.g., '/MyApexClass')", }, "method": { "type": "string", "description": "The HTTP method (default: 'GET')", "enum": ["GET", "POST", "PATCH", "DELETE"], "default": "GET", }, "data": { "type": "object", "description": "Data for POST/PATCH requests", "properties": {}, "additionalProperties": True, }, }, "required": ["action"], }, ),
  • JSON schema defining the input parameters for the 'apex_execute' tool: required 'action' string, optional 'method' enum, optional 'data' object.
    inputSchema={ "type": "object", "properties": { "action": { "type": "string", "description": "The Apex REST endpoint to call (e.g., '/MyApexClass')", }, "method": { "type": "string", "description": "The HTTP method (default: 'GET')", "enum": ["GET", "POST", "PATCH", "DELETE"], "default": "GET", }, "data": { "type": "object", "description": "Data for POST/PATCH requests", "properties": {}, "additionalProperties": True, }, }, "required": ["action"], },

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/ampcome-mcps/salesforce-mcp'

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