Skip to main content
Glama
codefriar

Salesforce CLI MCP Server

sf_list_roots

Display all configured Salesforce project directories and their metadata to manage development environments and access project information.

Instructions

List all configured Salesforce project directories and their metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Inline handler function registered for 'sf_list_roots' tool that retrieves project roots using getProjectRoots() and formats them into a markdown-style list for display.
    server.tool('sf_list_roots', 'List all configured Salesforce project directories and their metadata', {}, async () => { const roots = getProjectRoots(); if (roots.length === 0) { return { content: [ { type: 'text', text: 'No project roots configured. Use sf_set_project_directory to add a project root.' } ] }; } // Format roots list for display const rootsList = roots.map(root => ( `- ${root.name || path.basename(root.path)}${root.isDefault ? ' (default)' : ''}: ${root.path}${root.description ? `\n Description: ${root.description}` : ''}` )).join('\n\n'); return { content: [ { type: 'text', text: `Configured Salesforce project roots:\n\n${rootsList}` } ] }; });
  • Helper function that returns a copy of the global projectRoots array, used by the sf_list_roots handler.
    export function getProjectRoots(): ProjectRoot[] { return [...projectRoots]; }
  • src/index.ts:93-120 (registration)
    Registration of the sf_list_roots tool using server.tool, with empty input schema and inline handler.
    server.tool('sf_list_roots', 'List all configured Salesforce project directories and their metadata', {}, async () => { const roots = getProjectRoots(); if (roots.length === 0) { return { content: [ { type: 'text', text: 'No project roots configured. Use sf_set_project_directory to add a project root.' } ] }; } // Format roots list for display const rootsList = roots.map(root => ( `- ${root.name || path.basename(root.path)}${root.isDefault ? ' (default)' : ''}: ${root.path}${root.description ? `\n Description: ${root.description}` : ''}` )).join('\n\n'); return { content: [ { type: 'text', text: `Configured Salesforce project roots:\n\n${rootsList}` } ] }; });

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/codefriar/sf-mcp'

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