Skip to main content
Glama

approve_directory

Grant temporary access to a specific directory for secure command execution within a session, enabling controlled system interaction while maintaining security boundaries.

Instructions

Approve access to a directory for the current session.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryYesThe directory to approve access to
session_idYesThe session ID
rememberNoWhether to remember this approval

Implementation Reference

  • The main handler implementation for the approve_directory tool. It validates the directory and delegates the actual approval logic to the session_manager.
    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,
            }
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 discloses minimal behavioral traits. It mentions 'current session' implying temporariness, but fails to explain what 'access' entails (read/write/execute), side effects, persistence mechanics of the 'remember' parameter, or failure modes.

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 is efficiently structured with the action verb front-loaded. While appropriately brief, it errs on the side of under-specification given the lack of annotations and security-sensitive nature of the operation.

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

Completeness2/5

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

For a permission/approval tool with no annotations and no output schema, the description is inadequate. It lacks critical security context, does not explain what capability the approval grants, omits interaction patterns with sibling execution tools, and provides no error handling or return value information.

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 100%, establishing a baseline of 3. The description adds minimal semantic value beyond the schema, though 'for the current session' provides slight context for the session_id parameter. No additional constraints, formats, or examples are provided.

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 verb (approve), resource (directory), and scope (current session). However, it does not explicitly distinguish from sibling tool 'approve_command_type', leaving implicit differentiation through the resource type mentioned.

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, prerequisites for invocation, or when approval is necessary. It does not clarify the relationship to 'execute_command' or if directory approval is required before command execution.

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