run_sosl_search
Execute SOSL searches in Salesforce to retrieve records matching specific criteria. Use this tool to find data across objects and fields with a single query.
Instructions
Executes a SOSL search against Salesforce
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| search | Yes | The SOSL search to execute (e.g., 'FIND {John Smith} IN ALL FIELDS') |
Implementation Reference
- src/salesforce/server.py:329-340 (handler)The handler function within @server.call_tool() that processes the tool call for 'run_sosl_search'. It retrieves the 'search' argument, executes sf_client.sf.search(), formats the results as JSON, and returns it as TextContent.elif name == "run_sosl_search": search = arguments.get("search") if not search: raise ValueError("Missing 'search' argument") results = sf_client.sf.search(search) return [ types.TextContent( type="text", text=f"SOSL Search Results (JSON):\n{json.dumps(results, indent=2)}", ) ]
- src/salesforce/server.py:121-134 (registration)The registration of the 'run_sosl_search' tool in the @server.list_tools() handler, including its description and JSON inputSchema requiring a 'search' string.types.Tool( name="run_sosl_search", description="Executes a SOSL search against Salesforce", inputSchema={ "type": "object", "properties": { "search": { "type": "string", "description": "The SOSL search to execute (e.g., 'FIND {John Smith} IN ALL FIELDS')", }, }, "required": ["search"], }, ),