delete_record
Remove a specific record from Salesforce by specifying the object name and record ID. Streamlines record deletion within the MCP Salesforce Connector for efficient data management.
Instructions
Deletes a record
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| object_name | Yes | The name of the Salesforce object (e.g., 'Account', 'Contact') | |
| record_id | Yes | The ID of the record to delete |
Implementation Reference
- src/salesforce/server.py:398-412 (handler)Executes the deletion of a Salesforce record by object name and ID using the simple-salesforce library.elif name == "delete_record": object_name = arguments.get("object_name") record_id = arguments.get("record_id") if not object_name or not record_id: raise ValueError("Missing 'object_name' or 'record_id' argument") if not sf_client.sf: raise ValueError("Salesforce connection not established.") sf_object = getattr(sf_client.sf, object_name) results = sf_object.delete(record_id) return [ types.TextContent( type="text", text=f"Delete {object_name} Record Result: {results}", ) ]
- src/salesforce/server.py:209-226 (registration)Registers the 'delete_record' tool with MCP server, including input schema for object_name and record_id.types.Tool( name="delete_record", description="Deletes a record", inputSchema={ "type": "object", "properties": { "object_name": { "type": "string", "description": "The name of the Salesforce object (e.g., 'Account', 'Contact')", }, "record_id": { "type": "string", "description": "The ID of the record to delete", }, }, "required": ["object_name", "record_id"], }, ),
- src/salesforce/server.py:212-225 (schema)JSON schema defining the input parameters for the delete_record tool: object_name and record_id.inputSchema={ "type": "object", "properties": { "object_name": { "type": "string", "description": "The name of the Salesforce object (e.g., 'Account', 'Contact')", }, "record_id": { "type": "string", "description": "The ID of the record to delete", }, }, "required": ["object_name", "record_id"], },