Skip to main content
Glama
smn2gnt

MCP Salesforce Connector

by smn2gnt

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
NameRequiredDescriptionDefault
searchYesThe SOSL search to execute (e.g., 'FIND {John Smith} IN ALL FIELDS')

Implementation Reference

  • 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)}",
            )
        ]
  • 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"],
        },
    ),
Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/smn2gnt/MCP-Salesforce'

If you have feedback or need assistance with the MCP directory API, please join our Discord server