Skip to content

Commit 8ba6b0b

Browse files
clydinalan-agius4
authored andcommitted
fix(@angular/cli): use correct path for MCP get_best_practices tool
The package internal path for the Angular best practices markdown file has been corrected to the new location following a previous refactoring. (cherry picked from commit eb42785)
1 parent ffe6fb9 commit 8ba6b0b

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

packages/angular/cli/src/commands/mcp/tools/best-practices.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const BEST_PRACTICES_TOOL = declareTool({
2626

2727
return async () => {
2828
bestPracticesText ??= await readFile(
29-
path.join(__dirname, '..', 'instructions', 'best-practices.md'),
29+
path.join(__dirname, '..', 'resources', 'best-practices.md'),
3030
'utf-8',
3131
);
3232

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { chdir } from 'node:process';
2+
import { exec, ProcessOutput, silentNpm } from '../../utils/process';
3+
import assert from 'node:assert/strict';
4+
5+
const MCP_INSPECTOR_PACKAGE_NAME = '@modelcontextprotocol/inspector-cli';
6+
const MCP_INSPECTOR_PACKAGE_VERSION = '0.16.2';
7+
const MCP_INSPECTOR_COMMAND_NAME = 'mcp-inspector-cli';
8+
9+
async function runInspector(...args: string[]): Promise<ProcessOutput> {
10+
const result = await exec(
11+
MCP_INSPECTOR_COMMAND_NAME,
12+
'--cli',
13+
'npx',
14+
'--no',
15+
'@angular/cli',
16+
'mcp',
17+
...args,
18+
);
19+
20+
return result;
21+
}
22+
23+
export default async function () {
24+
await silentNpm(
25+
'install',
26+
'--ignore-scripts',
27+
'-g',
28+
`${MCP_INSPECTOR_PACKAGE_NAME}@${MCP_INSPECTOR_PACKAGE_VERSION}`,
29+
);
30+
31+
// Ensure `get_best_practices` returns the markdown content
32+
const { stdout: stdoutInsideWorkspace } = await runInspector(
33+
'--method',
34+
'tools/call',
35+
'--tool-name',
36+
'get_best_practices',
37+
);
38+
39+
assert.match(
40+
stdoutInsideWorkspace,
41+
/You are an expert in TypeScript, Angular, and scalable web application development./,
42+
);
43+
}

0 commit comments

Comments
 (0)