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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:93-120 (handler)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}` } ] }; }); - src/sfCommands.ts:192-194 (helper)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}` } ] }; });