Skip to main content
Glama

set_project_path

Define the base project directory to enable code indexing, search, and analysis for large language models with minimal setup.

Instructions

Set the base project path for indexing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • MCP tool handler for 'set_project_path'. This is the entry point decorated with @mcp.tool() that registers and executes the tool logic by calling ProjectManagementService.initialize_project(path).
    @mcp.tool() @handle_mcp_tool_errors(return_type='str') def set_project_path(path: str, ctx: Context) -> str: """Set the base project path for indexing.""" return ProjectManagementService(ctx).initialize_project(path)
  • Core business logic implementation delegated to by the MCP tool handler. Orchestrates project initialization including validation, index setup, file monitoring, and state updates.
    def initialize_project(self, path: str) -> str: """ Initialize a project with comprehensive business logic. This is the main business method that orchestrates the project initialization workflow, handling validation, cleanup, setup, and coordination of all project components. Args: path: Project directory path to initialize Returns: Success message with project information Raises: ValueError: If path is invalid or initialization fails """ # Business validation self._validate_initialization_request(path) # Business workflow: Execute initialization result = self._execute_initialization_workflow(path) # Business result formatting return self._format_initialization_result(result)
  • Internal shallow index manager's set_project_path method, called during project initialization.
    def set_project_path(self, project_path: str) -> bool: with self._lock: try: if not isinstance(project_path, str) or not project_path.strip(): logger.error("Invalid project path for shallow index")
  • Registration of the 'set_project_path' tool via @mcp.tool() decorator.
    @mcp.tool() @handle_mcp_tool_errors(return_type='str') def set_project_path(path: str, ctx: Context) -> str: """Set the base project path for indexing.""" return ProjectManagementService(ctx).initialize_project(path)

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