Skip to main content
Glama
andresthor

Command-Line MCP Server

by andresthor

approve_directory

Grant temporary or persistent directory access permissions within a controlled command-line environment to enable secure file operations during AI-assisted terminal sessions.

Instructions

Approve access to a directory for the current session.

Args: directory: The directory to approve access to session_id: The session ID remember: Whether to remember this approval for the session

Returns: A dictionary with approval status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryYes
session_idYes
rememberNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler for the 'approve_directory' MCP tool which normalizes the path, checks for existing approvals, and registers the approval in the SessionManager.
    async def approve_directory(
        directory: str, session_id: str, remember: bool = True
    ) -> dict[str, Any]:
        """
        Approve access to a directory for the current session.
    
        Args:
            directory: The directory to approve access to
            session_id: The session ID
            remember: Whether to remember this approval for the session
    
        Returns:
            A dictionary with approval status
        """
        # Normalize the directory path
        normalized_dir = normalize_path(directory)
    
        # Check if directory is already whitelisted globally
        if is_directory_whitelisted(normalized_dir, self.whitelisted_directories):
            return {
                "success": True,
                "message": f"Directory '{normalized_dir}' is already globally whitelisted",
                "directory": normalized_dir,
            }
    
        # Check if directory is already approved for this session
        if self.session_manager.has_directory_approval(session_id, normalized_dir):
            return {
                "success": True,
                "message": f"Directory '{normalized_dir}' is already approved for this session",
                "directory": normalized_dir,
            }
    
        # Approve the directory for this session
        if remember:
            self.session_manager.approve_directory(session_id, normalized_dir)
            return {
                "success": True,
                "message": f"Directory '{normalized_dir}' approved for this session",
                "directory": normalized_dir,
            }
        else:
  • The underlying SessionManager method that records the directory approval for a specific session.
    def approve_directory(self, session_id: str, directory: str) -> None:
        """Approve a directory for a session.
    
        Args:
            session_id: The session ID
            directory: The directory to approve
        """
        session = self.get_session(session_id)
        session["approved_directories"].add(directory)
Behavior2/5

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

With no annotations provided, the description carries full burden but lacks critical behavioral details. It doesn't disclose whether this requires special permissions, if it's idempotent, what happens on failure, or any rate limits. The mention of 'remember this approval' hints at persistence but is insufficient for a mutation tool.

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 description is front-loaded with the core purpose, followed by structured parameter and return sections. It's efficient with minimal waste, though the parameter explanations could be more informative to earn a 5.

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 3 parameters with 0% schema coverage and no annotations, the description is moderately complete but lacks depth for a mutation tool. The output schema exists, so return values needn't be explained, but behavioral and usage gaps remain significant.

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?

Schema description coverage is 0%, so the description must compensate. It lists all three parameters with brief explanations, adding meaning beyond the bare schema. However, it doesn't detail format constraints (e.g., directory path syntax) or the implications of 'remember', keeping it at baseline adequacy.

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 ('Approve access to') and resource ('a directory'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'list_directories' or 'execute_command', which would require a 5.

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 like 'list_directories' or 'execute_command'. It mentions 'for the current session' but doesn't explain prerequisites or exclusions, leaving usage context vague.

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/andresthor/cmd-line-mcp'

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