Skip to main content
Glama

list_directories

View all approved directories for secure command execution in the cmd-line-mcp server, with optional session-specific filtering.

Instructions

List all whitelisted and approved directories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idNoOptional session ID to get session-specific approvals

Implementation Reference

  • The 'list_directories' tool handler function that retrieves whitelisted and session-approved directories.
    async def list_directories(session_id: Optional[str] = None) -> Dict[str, Any]:
        """
        List all whitelisted and approved directories.
    
        Args:
            session_id: Optional session ID to get session-specific approvals
    
        Returns:
            A dictionary with globally whitelisted and session-approved directories
        """
        result = {
            "whitelisted_directories": self.whitelisted_directories,
            "session_approved_directories": [],
        }
    
        if session_id:
            result["session_approved_directories"] = list(
                self.session_manager.get_approved_directories(session_id)
            )
    
        return result
  • Tool registration for 'list_directories' using the application's tool decorator.
    list_directories_tool = self.app.tool()
    
    @list_directories_tool  # Keep decorator reference to satisfy linters
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 but fails to state whether this is a read-only operation, what data structure is returned, or how 'whitelisted' differs from 'approved'. It omits security implications and error conditions.

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

Conciseness4/5

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

The single-sentence description is extremely compact (6 words) with no wasted language. However, it borders on underspecification given the security context and optional parameter; additional context would improve utility without sacrificing clarity.

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?

For a tool with one optional parameter and no output schema, the description meets minimum viability by identifying the core resource. However, given the security context (whitelisting/approvals), it lacks necessary context about the approval workflow and session-scoping behavior.

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

Parameters3/5

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

The input schema has 100% description coverage for the 'session_id' parameter, establishing the baseline. The description adds no parameter-specific context, but given the complete schema coverage, this is acceptable. The description neither repeats nor contradicts the schema documentation.

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 uses a specific verb ('List') and clear resource ('whitelisted and approved directories'), establishing the tool's function effectively. It implicitly connects to the sibling tool 'approve_directory' by referencing the approval concept, though it doesn't explicitly differentiate from 'list_available_commands'.

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?

No guidance is provided on when to use this tool versus siblings like 'approve_directory', or when to utilize the optional 'session_id' parameter. The description lacks prerequisites, exclusions, or contextual advice for the security-sensitive domain of directory whitelisting.

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/wwqdrh/MCPcmd'

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