tooling_execute
Execute Tooling API requests on Salesforce MCP, enabling actions like GET, POST, PATCH, and DELETE calls to endpoints such as 'sobjects/ApexClass' for streamlined data management.
Instructions
Executes a Tooling API request
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | The Tooling API endpoint to call (e.g., 'sobjects/ApexClass') | |
| data | No | Data for POST/PATCH requests | |
| method | No | The HTTP method (default: 'GET') | GET |
Implementation Reference
- src/salesforce/server.py:404-420 (handler)The handler logic within @server.call_tool() that processes the tooling_execute tool call: validates inputs, executes the Tooling API via simple-salesforce, and formats the response.elif name == "tooling_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.toolingexecute(action, method=method, data=data) return [ types.TextContent( type="text", text=f"Tooling Execute Result (JSON):\n{json.dumps(results, indent=2)}", ) ]
- src/salesforce/server.py:218-243 (registration)Registers the 'tooling_execute' tool in the @server.list_tools() handler, including name, description, and input schema.types.Tool( name="tooling_execute", description="Executes a Tooling API request", inputSchema={ "type": "object", "properties": { "action": { "type": "string", "description": "The Tooling API endpoint to call (e.g., 'sobjects/ApexClass')", }, "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"], }, ),
- src/salesforce/server.py:218-243 (schema)Defines the input schema for the tooling_execute tool, specifying parameters action (required), method, and data.types.Tool( name="tooling_execute", description="Executes a Tooling API request", inputSchema={ "type": "object", "properties": { "action": { "type": "string", "description": "The Tooling API endpoint to call (e.g., 'sobjects/ApexClass')", }, "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"], }, ),