Skip to main content
Glama
NovaAI-innovation

CSV MCP Server

get_path_info

Analyzes file paths to determine properties like absolute/relative status, resolved location, parent directory, existence, accessibility, and safety validation for CSV operations.

Instructions

Get detailed information about a file path, supporting both relative and absolute paths.

Args:
    filepath: The file path to analyze (can be relative or absolute)

Returns:
    Dictionary with comprehensive path information including:
    - Whether the path is absolute or relative
    - Resolved path (following symlinks)
    - Parent directory information
    - File existence and accessibility
    - Safety validation for absolute paths

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filepathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for 'get_path_info', registered with @mcp.tool(), delegates to CSVManager.get_absolute_path_info for execution.
    @mcp.tool()
    def get_path_info(filepath: str) -> Dict[str, Any]:
        """
        Get detailed information about a file path, supporting both relative and absolute paths.
        
        Args:
            filepath: The file path to analyze (can be relative or absolute)
        
        Returns:
            Dictionary with comprehensive path information including:
            - Whether the path is absolute or relative
            - Resolved path (following symlinks)
            - Parent directory information
            - File existence and accessibility
            - Safety validation for absolute paths
        """
        try:
            return csv_manager.get_absolute_path_info(filepath)
        except Exception as e:
            return {"success": False, "error": str(e)}
  • Core helper method implementing the path information logic, including path resolution, file stats, parent directory checks, and safety validation using _is_path_safe.
    def get_absolute_path_info(self, filepath: str) -> Dict[str, Any]:
        """Get information about a file path, supporting both relative and absolute paths."""
        try:
            path = Path(filepath)
            
            # Determine if it's absolute or relative
            is_absolute = path.is_absolute()
            
            # Get the resolved path (follows symlinks)
            try:
                resolved_path = path.resolve()
            except (OSError, RuntimeError):
                resolved_path = path
            
            # Check if file exists
            exists = path.exists()
            
            # Get file info if it exists
            file_info = None
            if exists and path.is_file():
                stat = path.stat()
                file_info = {
                    "size_bytes": stat.st_size,
                    "size_mb": round(stat.st_size / (1024 * 1024), 2),
                    "modified_time": datetime.fromtimestamp(stat.st_mtime).isoformat(),
                    "is_csv": path.suffix.lower() == '.csv'
                }
            
            # Check directory access
            parent_dir = path.parent
            parent_exists = parent_dir.exists()
            parent_accessible = parent_exists and os.access(parent_dir, os.R_OK | os.W_OK)
            
            return {
                "success": True,
                "original_path": filepath,
                "is_absolute": is_absolute,
                "resolved_path": str(resolved_path),
                "parent_directory": str(parent_dir),
                "parent_exists": parent_exists,
                "parent_accessible": parent_accessible,
                "file_exists": exists,
                "is_file": exists and path.is_file(),
                "is_directory": exists and path.is_dir(),
                "file_info": file_info,
                "path_valid": self._is_path_safe(path) if is_absolute else True
            }
        except Exception as e:
            logger.error(f"Failed to get path info: {e}")
            return {"success": False, "error": str(e)}
Behavior4/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. It effectively describes key behaviors: it returns comprehensive information including path resolution, existence checks, and safety validation, which goes beyond basic read operations. However, it lacks details on potential side effects, error handling, or performance considerations, leaving some gaps in transparency.

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?

The description is well-structured and front-loaded, starting with a clear purpose statement followed by organized sections for Args and Returns. Every sentence adds value, with no redundant or unnecessary information, making it efficient and easy to parse for an AI agent.

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

Completeness5/5

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

Given the tool's moderate complexity, no annotations, and an output schema that likely covers return values, the description is complete enough. It explains the tool's purpose, parameter semantics, and return structure comprehensively, providing all necessary context for an agent to invoke it correctly without needing additional details from structured fields.

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

Parameters5/5

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

The description adds significant meaning beyond the input schema, which has 0% coverage. It explains that the 'filepath' parameter can be 'relative or absolute' and specifies what the tool analyzes, compensating fully for the schema's lack of descriptions. This provides clear context for the single parameter, making it easy to understand its purpose and usage.

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 clearly states the tool's purpose with a specific verb ('Get detailed information') and resource ('about a file path'), distinguishing it from sibling tools like get_info, get_statistics, or list_csv_files by focusing specifically on path analysis rather than general data operations. It explicitly mentions support for both relative and absolute paths, which further clarifies its scope.

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?

The description implies usage through the mention of 'supporting both relative and absolute paths,' suggesting it's for analyzing file paths, but it doesn't explicitly state when to use this tool versus alternatives like get_info or other sibling tools. There's no guidance on prerequisites, exclusions, or specific scenarios where this tool is preferred over others.

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/NovaAI-innovation/csv-mcp-server'

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