Skip to main content
Glama

check_temp_directory

Verify the location and status of the temporary directory where index data is stored, ensuring proper setup for code indexing.

Instructions

Check the temporary directory used for storing index data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool registration for check_temp_directory via @mcp.tool() decorator, delegates to manage_temp_directory('check')
    @mcp.tool()
    @handle_mcp_tool_errors(return_type="dict")
    def check_temp_directory() -> dict[str, Any]:
        """Check the temporary directory used for storing index data."""
        return manage_temp_directory("check")
  • Core logic for check_temp_directory: checks directory status, lists contents and subdirectories, returns formatted response
    else:  # action == 'check'
        result = ResponseFormatter.directory_info_response(
            temp_directory=temp_dir,
            exists=os.path.exists(temp_dir),
            is_directory=os.path.isdir(temp_dir) if os.path.exists(temp_dir) else False,
        )
        result["temp_root"] = tempfile.gettempdir()
    
        # If the directory exists, list its contents
        if result["exists"] and result["is_directory"]:
            try:
                contents = os.listdir(temp_dir)
                result["contents"] = contents
                result["subdirectories"] = []
    
                # Check each subdirectory
                for item in contents:
                    item_path = os.path.join(temp_dir, item)
                    if os.path.isdir(item_path):
                        subdir_info = {
                            "name": item,
                            "path": item_path,
                            "contents": os.listdir(item_path)
                            if os.path.exists(item_path)
                            else [],
                        }
                        result["subdirectories"].append(subdir_info)
    
            except (OSError, PermissionError) as e:
                result["error"] = str(e)
    
        return result
  • Low-level SettingsTool.check_temp_directory method that checks directory existence and lists subdirectory contents
    def check_temp_directory(self) -> Dict[str, Any]:
        """
        Check the status of the temporary directory.
    
        Returns:
            Dictionary with directory status information
        """
        temp_dir = self.get_temp_directory_path()
    
        result = {
            "temp_directory": temp_dir,
            "temp_root": tempfile.gettempdir(),
            "exists": os.path.exists(temp_dir),
            "is_directory": os.path.isdir(temp_dir) if os.path.exists(temp_dir) else False
        }
    
        # If the directory exists, list its contents
        if result["exists"] and result["is_directory"]:
            try:
                contents = os.listdir(temp_dir)
                result["contents"] = contents
                result["subdirectories"] = []
    
                # Check each subdirectory
                for item in contents:
                    item_path = os.path.join(temp_dir, item)
                    if os.path.isdir(item_path):
                        subdir_info = {
                            "name": item,
                            "path": item_path,
                            "contents": os.listdir(item_path) if os.path.exists(item_path) else []
                        }
                        result["subdirectories"].append(subdir_info)
    
            except (OSError, PermissionError) as e:
                result["error"] = str(e)
    
        return result
  • ResponseFormatter.directory_info_response - formats the directory info response dictionary used by check_temp_directory
    def directory_info_response(
        temp_directory: str,
        exists: bool,
        is_directory: bool = False,
        contents: Optional[List[str]] = None,
        subdirectories: Optional[List[Dict[str, Any]]] = None,
        error: Optional[str] = None
    ) -> Dict[str, Any]:
        """
        Format directory information response.
        
        Args:
            temp_directory: Path to the directory
            exists: Whether the directory exists
            is_directory: Whether the path is a directory
            contents: List of directory contents
            subdirectories: List of subdirectory information
            error: Error message if operation failed
            
        Returns:
            Formatted directory info response
        """
        response = {
            "temp_directory": temp_directory,
            "exists": exists,
            "is_directory": is_directory
        }
        
        if contents is not None:
            response["contents"] = contents
        
        if subdirectories is not None:
            response["subdirectories"] = subdirectories
        
        if error:
            response["error"] = error
        
        return response
Behavior3/5

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

No annotations provided; the description only states 'Check' without disclosing side effects or safety profile, leaving the agent to infer it is read-only.

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?

Single sentence with no extraneous text, efficiently conveying the tool's purpose.

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

Completeness4/5

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

Has an output schema to explain return values, but the description could be more informative (e.g., what exactly is checked). Still adequate for a simple tool.

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?

No parameters exist and schema coverage is 100%; description adds no parameter info, but zero parameters warrant a baseline of 4.

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

Purpose5/5

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

The description uses the verb 'Check' and specifies the resource 'temporary directory used for storing index data,' clearly differentiating from sibling tools like 'create_temp_directory' which creates a directory.

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

Usage Guidelines3/5

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

No explicit guidance on when to use this tool versus alternatives such as 'get_settings_info' or 'create_temp_directory'; usage is implied but not clarified.

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/johnhuang316/code-index-mcp'

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