Skip to content

fix(@angular/cli): use correct path for MCP get_best_practices tool #30904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const BEST_PRACTICES_TOOL = declareTool({

return async () => {
bestPracticesText ??= await readFile(
path.join(__dirname, '..', 'instructions', 'best-practices.md'),
path.join(__dirname, '..', 'resources', 'best-practices.md'),
'utf-8',
);

Expand Down
43 changes: 43 additions & 0 deletions tests/legacy-cli/e2e/tests/mcp/best-practices.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { chdir } from 'node:process';
import { exec, ProcessOutput, silentNpm } from '../../utils/process';
import assert from 'node:assert/strict';

const MCP_INSPECTOR_PACKAGE_NAME = '@modelcontextprotocol/inspector-cli';
const MCP_INSPECTOR_PACKAGE_VERSION = '0.16.2';
const MCP_INSPECTOR_COMMAND_NAME = 'mcp-inspector-cli';

async function runInspector(...args: string[]): Promise<ProcessOutput> {
const result = await exec(
MCP_INSPECTOR_COMMAND_NAME,
'--cli',
'npx',
'--no',
'@angular/cli',
'mcp',
...args,
);

return result;
}

export default async function () {
await silentNpm(
'install',
'--ignore-scripts',
'-g',
`${MCP_INSPECTOR_PACKAGE_NAME}@${MCP_INSPECTOR_PACKAGE_VERSION}`,
);

// Ensure `get_best_practices` returns the markdown content
const { stdout: stdoutInsideWorkspace } = await runInspector(
'--method',
'tools/call',
'--tool-name',
'get_best_practices',
);

assert.match(
stdoutInsideWorkspace,
/You are an expert in TypeScript, Angular, and scalable web application development./,
);
}