Skip to main content
Glama

salesforce_list_objects

Retrieve all Salesforce object names (SObjects) to discover available data entities in your Salesforce organization for integration and query planning.

Instructions

Get list of all Salesforce object names (SObjects)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main tool handler function that instantiates SalesforceClient from environment settings and calls its list_objects method, wrapping the result in ListObjectsResult.
    async def list_salesforce_objects() -> ListObjectsResult: """Get list of Salesforce object names""" sf = SalesforceClient.from_env() object_names = await sf.list_objects() return ListObjectsResult( object_names=object_names, total_count=len(object_names) )
  • Pydantic BaseModel defining the input/output schema for the salesforce_list_objects tool response.
    class ListObjectsResult(BaseModel): object_names: List[str] = Field(..., description="List of Salesforce object names") total_count: int = Field(..., description="Total number of objects")
  • The register function that defines the tool using @mcp.tool decorator, specifying name and description.
    def register(mcp: FastMCP) -> None: @mcp.tool( name="salesforce_list_objects", description="Get list of all Salesforce object names (SObjects)", ) async def list_salesforce_objects() -> ListObjectsResult: """Get list of Salesforce object names""" sf = SalesforceClient.from_env() object_names = await sf.list_objects() return ListObjectsResult( object_names=object_names, total_count=len(object_names) )
  • sfmcp/server.py:23-33 (registration)
    The _register_all function called on server startup that invokes register on the list_objects tool module (line 26), thereby registering the tool with the MCP server.
    def _register_all() -> None: tool_query.register(mcp) tool_describe.register(mcp) tool_list_objects.register(mcp) tool_list_flows.register(mcp) tool_list_reports.register(mcp) tool_list_dashboards.register(mcp) tool_describe_flow.register(mcp) # res_saved_queries.register(mcp) # prm_opps_by_stage.register(mcp)
  • Supporting utility in SalesforceClient that runs the 'sf force:schema:sobject:list' CLI command to retrieve the list of SObject names asynchronously.
    async def list_objects(self) -> List[str]: """Get list of all Salesforce object names""" command = [ "sf", "force:schema:sobject:list", "--target-org", self._org_alias, "--json", ] result = await self._run_cli_command(command) if "result" in result and isinstance(result["result"], list): return result["result"] else: raise Exception("Unexpected response format from Salesforce CLI")

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/mattmahowald/sfmcp'

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