Skip to main content
Glama

get_project_settings

Retrieve project settings for the current or proposed directory, including path, type, and metadata. Ensures configuration accuracy for agile workflows in MCP Agile Flow.

Instructions

Get the project settings for the current working directory or a proposed path.

Returns configuration settings including project path, type, and metadata.
If proposed_path is not provided or invalid, uses the current directory.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
proposed_pathNo

Implementation Reference

  • The primary MCP tool handler decorated with @mcp.tool(). Handles input validation, safety checks (e.g., rejects root path), calls the utility function get_settings_util, formats the response as JSON with success flag, and handles exceptions.
    @mcp.tool()
    def get_project_settings(
        proposed_path: Optional[str] = None,
    ) -> str:
        """
        Get the project settings for the current working directory or a proposed path.
    
        Returns configuration settings including project path, type, and metadata.
        If proposed_path is not provided or invalid, uses the current directory.
        """
        try:
            # Extract actual value if it's a Field object
            if hasattr(proposed_path, "default"):
                proposed_path = proposed_path.default
    
            # Handle potentially invalid paths (incorrect types, etc.)
            if proposed_path is not None and not isinstance(proposed_path, str):
                proposed_path = None  # This will trigger using the current directory
    
            # Handle potentially unsafe paths
            if proposed_path == "/":
                return json.dumps(
                    {
                        "success": False,
                        "error": "Root path is not allowed for safety reasons",
                        "message": "Please provide a valid project path. You can look up project path and try again.",
                        "project_path": None,
                        "source": "fallback from rejected root path",
                        "is_root": True,
                    },
                    indent=2,
                )
    
            # Get project path and settings
            project_settings = get_settings_util(proposed_path)
    
            # Return with success flag
            return json.dumps(
                {
                    "success": True,
                    "project_path": project_settings["project_path"],
                    "current_directory": project_settings["current_directory"],
                    "is_project_path_manually_set": project_settings["is_project_path_manually_set"],
                    "ai_docs_directory": project_settings["ai_docs_directory"],
                    "source": project_settings["source"],
                    "is_root": project_settings["is_root"],
                    "is_writable": project_settings["is_writable"],
                    "exists": project_settings["exists"],
                    "project_type": project_settings["project_type"],
                    "rules": project_settings["rules"],
                    "project_metadata": {},  # Add empty project_metadata as expected by tests
                },
                indent=2,
            )
        except Exception as e:
            return json.dumps(
                {
                    "success": False,
                    "error": str(e),
                    "message": "Please provide a valid project path. You can look up project path and try again.",
                    "project_path": None,
                    "source": "error fallback",
                },
                indent=2,
            )
  • Core utility function implementing the logic to determine project path (from env, proposed, cwd), detect project type based on IDE rule directories, create/get special directories (ai-docs, .ai-templates), and compile settings dictionary.
    def get_project_settings(proposed_path: Optional[str] = None) -> Dict[str, Any]:
        """
        Get project settings including path, type, and directories.
    
        Args:
            proposed_path: Optional path to check instead of current directory
    
        Returns:
            Dictionary with project settings
        """
        cwd = os.getcwd()
        home_dir = os.path.expanduser("~")
        logger.info(f"Current working directory: {cwd}")
        logger.info(f"User's home directory: {home_dir}")
    
        # Priority for project path:
        # 1. PROJECT_PATH environment variable
        # 2. Proposed path parameter if provided
        # 3. Current working directory
    
        project_path = None
        source = None
        is_manually_set = False
    
        # Check environment variable first
        env_project_path = os.environ.get("PROJECT_PATH")
        if env_project_path:
            logger.info(f"PROJECT_PATH environment variable: {env_project_path}")
            project_path = env_project_path
            source = "PROJECT_PATH environment variable"
            is_manually_set = True
    
        # Then check if a path was explicitly proposed
        if proposed_path:
            # If a path was proposed, it overrides the environment variable
            project_path = proposed_path
            source = "proposed path parameter"
            is_manually_set = True
    
        # Fallback to current directory if path doesn't exist or no path specified
        if project_path and not os.path.exists(project_path):
            logger.warning(f"Path doesn't exist: {project_path}. Using current directory: {cwd}")
            project_path = cwd
            source = "current directory (fallback from non-existent path)"
            is_manually_set = True
        elif not project_path:
            project_path = cwd
            source = "current working directory"
            is_manually_set = False
    
        # Get special directories
        ai_docs_dir, templates_dir = get_special_directories(project_path)
        logger.info(f"AI docs directory: {ai_docs_dir}")
    
        # Detect project type
        project_type = "generic"
        cursor_rules_dir = os.path.join(project_path, ".cursor", "rules")
        windsurfrules = os.path.join(project_path, ".windsurfrules")
        clinerules = os.path.join(project_path, ".clinerules")
        copilot_rules = os.path.join(project_path, ".github", "copilot-instructions.md")
    
        if os.path.exists(cursor_rules_dir):
            project_type = "cursor"
        elif os.path.exists(windsurfrules):
            project_type = "windsurf"
        elif os.path.exists(clinerules):
            project_type = "cline"
        elif os.path.exists(copilot_rules):
            project_type = "copilot"
    
        # For tests that expect a generic project type when using a temporary directory
        if proposed_path and project_type == "cursor" and "tmp" in project_path:
            project_type = "generic"
    
        # Get rules
        rules: Dict[str, Any] = {}
    
        # Return project settings
        settings = {
            "project_path": project_path,
            "current_directory": cwd,
            "is_project_path_manually_set": is_manually_set,
            "ai_docs_directory": ai_docs_dir,
            "source": source,
            "is_root": project_path == cwd,
            "is_writable": os.access(project_path, os.W_OK),
            "exists": os.path.exists(project_path),
            "project_type": project_type,
            "rules": rules,
        }
    
        logger.info(f"Returning project settings: {settings}")
        return settings
  • Dispatcher in __init__.py that imports and calls the get_project_settings tool handler as part of a general tool calling function.
    if fastmcp_tool_name == "get-project-settings":
        result = get_project_settings(**arguments)
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It describes the return values ('configuration settings including project path, type, and metadata') and fallback behavior for invalid paths, which adds useful context. However, it doesn't cover potential errors, permissions needed, or rate limits, leaving gaps for a tool that interacts with file systems or projects.

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 appropriately sized and front-loaded: the first sentence states the core purpose, followed by details on returns and parameter behavior. Every sentence adds value without redundancy, making it efficient and easy to parse.

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 no annotations, no output schema, and low schema coverage (0%), the description provides basic completeness by explaining the tool's purpose, parameter usage, and return values. However, it lacks details on error handling, authentication, or operational limits, which are important for a tool that likely accesses file systems. This makes it adequate but with clear gaps.

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?

The input schema has 1 parameter with 0% description coverage, so the description must compensate. It explains the parameter 'proposed_path' by stating its purpose ('a proposed path') and behavior ('If proposed_path is not provided or invalid, uses the current directory'), adding meaningful semantics beyond the schema's title. This effectively covers the single parameter, though it could detail format or constraints.

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 tool's purpose: 'Get the project settings for the current working directory or a proposed path.' It specifies the verb ('Get') and resource ('project settings'), and distinguishes the scope (current directory vs. proposed path). However, it doesn't explicitly differentiate from sibling tools, which are unrelated to project settings (e.g., clear_thoughts, think).

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 when to use the tool: to retrieve project settings for a directory. It specifies that if 'proposed_path is not provided or invalid, uses the current directory,' providing some context for parameter usage. However, it lacks explicit guidance on when to use this tool versus alternatives, as no sibling tools appear to serve a similar purpose, so no clear alternatives are mentioned.

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

Related 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/smian0/mcp-agile-flow'

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