Skip to content

mcp: a projectPath naming a file inside a project returns isError ("Path is not a directory") #2982

Closed

Description

@inth3shadows

A projectPath that names a file inside an indexed project is refused with isError: true ("Path is not a directory"), while a path that doesn't exist at all resolves fine.

call result on main
codegraph_status {"projectPath": "<proj>/src/a.ts"} isError: true, "Error: Path is not a directory: …/src/a.ts"
codegraph_status {"projectPath": "<proj>/no/such/dir"} success: the project's status (walks up to .codegraph/)

Cause. mcp/tools.ts#L2355 runs validateProjectPath on an existing path, which returns "Path is not a directory" (utils.ts#L218). That error is surfaced like a path refusal: isError, with no guidance.

Reproduced on main at 77ee348 (serve --mcp over stdio, Linux/WSL2, Node 22.23.2).

Why it matters. Passing the file it's looking at as projectPath is an easy agent mistake, and AGENTS.md reserves isError for "stop trying" cases ("Errors teach abandonment"). A file path inside a project is recoverable.

Expected. For an existing file, use its directory and walk up to .codegraph/ as for any other path inside the project. Or at least return a success-shaped hint ("projectPath should be the project directory; using

").

Activity

  1. colbymchenry commented on Oct 30, 2026

    @colbymchenry
    Owner

    Thanks for the report and the clear table! An MCP call whose projectPath names a file inside an indexed project now answers from that project instead of returning isError "Path is not a directory", and a file inside a sensitive folder is still refused. The fix is #3075; it's on main and ships in the next release.

  2. added a commit that references this issue on Oct 30, 2026
    1c40e34
  3. added a commit that references this issue on Oct 30, 2026
    018c394
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions