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}`
                }
            ]
        };
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't cover important aspects like whether it's read-only, requires authentication, has rate limits, or what the output format looks like. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has no parameters and no output schema, the description provides basic purpose information but lacks important context about behavior, output format, and usage guidelines. For a tool with no annotations and no output schema, more completeness would be expected to help the agent understand what to expect from the operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema already fully documents the input requirements. The description appropriately doesn't add parameter information beyond what's in the schema, maintaining a baseline score of 4 for tools with no parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List') and the resource ('all configured Salesforce project directories and their metadata'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like sf_detect_project_directory or sf_set_project_directory, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of prerequisites, timing, or comparison to siblings like sf_cache_clear or sf_detect_project_directory, leaving the agent without contextual usage instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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