get_project_directory_files
Retrieve saved findings and data files from the project directory for security assessment review and analysis.
Instructions
read existing files from the project directory to see what findings and data have been saved
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/pentestmcp/server.py:133-160 (handler)The main handler function for the 'get_project_directory_files' tool. It lists all files and directories in the project directory (config.PROJECT_DIRECTORY), showing type (FILE/DIR), size, modified time, and name in a formatted table. Handles errors like non-existent directory.@mcp.tool(name="get_project_directory_files", description="read existing files from the project directory to see what findings and data have been saved") def get_project_directory_files(): try: project_path = Path(config.PROJECT_DIRECTORY) if not project_path.exists(): return f"Project directory does not exist: {project_path}" if not project_path.is_dir(): return f"Project path is not a directory: {project_path}" files_info = [] for item in project_path.iterdir(): stat = item.stat() file_type = "DIR" if item.is_dir() else "FILE" size = stat.st_size modified = datetime.fromtimestamp(stat.st_mtime).strftime("%Y-%m-%d %H:%M:%S") files_info.append(f"{file_type:<4} {size:>8} {modified} {item.name}") if not files_info: return f"Project directory is empty: {project_path}" header = f"Contents of {project_path}:\nTYPE SIZE MODIFIED NAME\n" + "-"*50 return header + "\n" + "\n".join(files_info) except Exception as e: return f"Error reading project directory: {str(e)}"
- src/pentestmcp/server.py:133-133 (registration)The @mcp.tool decorator registers the 'get_project_directory_files' function as an MCP tool with the specified name and description.@mcp.tool(name="get_project_directory_files", description="read existing files from the project directory to see what findings and data have been saved")