get_record
Retrieve Salesforce records by specifying object type and ID to access specific data entries.
Instructions
Retrieves a specific record by ID
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 retrieve |
Implementation Reference
- src/salesforce/server.py:343-357 (handler)Handler implementation for the 'get_record' tool. Extracts object_name and record_id from arguments, connects to Salesforce client, retrieves the specific record using simple-salesforce's get method, and returns the record data as JSON text content.elif name == "get_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.get(record_id) return [ types.TextContent( type="text", text=f"{object_name} Record (JSON):\n{json.dumps(results, indent=2)}", ) ]
- src/salesforce/server.py:138-155 (registration)Registration of the 'get_record' tool in the @server.list_tools() handler. Defines the tool name, description, and input JSON schema requiring 'object_name' and 'record_id'.types.Tool( name="get_record", description="Retrieves a specific record by 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 retrieve", }, }, "required": ["object_name", "record_id"], }, ),
- src/salesforce/server.py:141-154 (schema)Input schema definition for the 'get_record' tool, specifying properties for object_name and record_id as required string parameters.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 retrieve", }, }, "required": ["object_name", "record_id"], },