run_sosl_search
Execute SOSL searches in Salesforce to find records matching specific keywords across all fields. Input a search query to retrieve relevant data efficiently.
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:327-338 (handler)Handler implementation that extracts the 'search' argument, performs SOSL search via Salesforce client, and returns formatted JSON results.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:122-131 (schema)JSON Schema defining the input for the run_sosl_search tool: requires a 'search' string parameter.inputSchema={ "type": "object", "properties": { "search": { "type": "string", "description": "The SOSL search to execute (e.g., 'FIND {John Smith} IN ALL FIELDS')", }, }, "required": ["search"], },
- src/salesforce/server.py:119-132 (registration)Registration of the run_sosl_search tool in the MCP server's list_tools handler, including name, description, and schema.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"], }, ),