set_project_context
Define the project root directory for Scalene profiling. Use when auto-detection fails or provides an incorrect path.
Instructions
Explicitly set the project root (overrides auto-detection).
Use this if auto-detection fails or gives wrong path.
Args: project_root: Absolute path to project root
Returns: {project_root, status}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_root | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/scalene_mcp/server.py:163-184 (handler)The handler function for the 'set_project_context' tool. It validates the provided path exists and is a directory, sets the global _project_root, and returns the project root and status.
async def set_project_context(project_root: str) -> dict[str, str]: """Explicitly set the project root (overrides auto-detection). Use this if auto-detection fails or gives wrong path. Args: project_root: Absolute path to project root Returns: {project_root, status} """ global _project_root path = Path(project_root) if not path.exists(): raise ValueError(f"Path does not exist: {project_root}") if not path.is_dir(): raise ValueError(f"Path is not a directory: {project_root}") _project_root = path return { "project_root": str(path.absolute()), "status": "set", } - src/scalene_mcp/server.py:187-187 (registration)Registration of set_project_context as a tool on the FastMCP server instance.
server.tool(set_project_context)