Problem
Since #32, analyze validates an explicit projectPath against the projects the server was started with and returns { error: "UnknownProject", message: "... not one of the AL projects this server was started with: <list> ..." } for anything else. list_rules still does projectPath ??= workspaceResolver.Config.PrimaryProject (src/ALCops.Mcp/Tools/ListRulesTool.cs:24) and resolves analyzers against whatever path it is given, so a mistyped project silently produces a (possibly empty or wrong) rule list instead of an error.
Two native tools sharing the same project-scoping concept should behave the same.
Proposed
- Extract the project validation from
AnalyzeTool into a shared helper (e.g. on WorkspaceStartupResolver or a small ProjectScope service) and use it in list_rules as well. get_fixes / apply_fix / apply_fix_all take a required projectPath and load it through ProjectSessionManager; decide whether they should validate too or keep accepting any folder with app.json.
- While there: when
Config.ProjectDirectories is empty the UnknownProject message renders as ...started with: . Pass one of those... (src/ALCops.Mcp/Tools/AnalyzeTool.cs:56-61). Print (none) or fall through to the NoProject error instead.
Found in the review rounds of #32.
Problem
Since #32,
analyzevalidates an explicitprojectPathagainst the projects the server was started with and returns{ error: "UnknownProject", message: "... not one of the AL projects this server was started with: <list> ..." }for anything else.list_rulesstill doesprojectPath ??= workspaceResolver.Config.PrimaryProject(src/ALCops.Mcp/Tools/ListRulesTool.cs:24) and resolves analyzers against whatever path it is given, so a mistyped project silently produces a (possibly empty or wrong) rule list instead of an error.Two native tools sharing the same project-scoping concept should behave the same.
Proposed
AnalyzeToolinto a shared helper (e.g. onWorkspaceStartupResolveror a smallProjectScopeservice) and use it inlist_rulesas well.get_fixes/apply_fix/apply_fix_alltake a requiredprojectPathand load it throughProjectSessionManager; decide whether they should validate too or keep accepting any folder withapp.json.Config.ProjectDirectoriesis empty theUnknownProjectmessage renders as...started with: . Pass one of those...(src/ALCops.Mcp/Tools/AnalyzeTool.cs:56-61). Print(none)or fall through to theNoProjecterror instead.Found in the review rounds of #32.