Skip to main content
Glama

sf_list_roots

Use this tool to list all configured Salesforce project directories and their metadata, enabling efficient management of Salesforce CLI projects and metadata.

Instructions

List all configured Salesforce project directories and their metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the sf_list_roots tool that retrieves and formats the list of configured Salesforce project roots.
    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 shallow copy of the global projectRoots array used by the sf_list_roots handler.
    export function getProjectRoots(): ProjectRoot[] { return [...projectRoots]; }
  • TypeScript interface defining the structure of a Salesforce project root, used by sf_list_roots and related functions.
    interface ProjectRoot { path: string; name?: string; description?: string; isDefault?: boolean; }
  • src/index.ts:93-120 (registration)
    Registration of the sf_list_roots tool on the MCP server, including 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}` } ] }; });

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

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