Skip to content

Commit e23730a

Browse files
committed
refactor(@angular/cli): expand MCP tool/resource descriptions
The descriptions for both the initial best practices resource and list projects tool have been expanded to provide more context regarding their use and results.
1 parent 939f783 commit e23730a

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

packages/angular/cli/src/commands/mcp/mcp-server.ts

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ export async function createMcpServer(context: {
2828
'instructions',
2929
'instructions://best-practices',
3030
{
31-
title: 'Angular System Instructions',
31+
title: 'Angular Best Practices and Code Generation Guide',
3232
description:
33-
'A set of instructions to help LLMs generate correct code that follows Angular best practices.',
33+
"A comprehensive guide detailing Angular's best practices for code generation and development. " +
34+
'This guide should be used as a reference by an LLM to ensure any generated code ' +
35+
'adheres to modern Angular standards, including the use of standalone components, ' +
36+
'typed forms, modern control flow syntax, and other current conventions.',
3437
mimeType: 'text/markdown',
3538
},
3639
async () => {
@@ -46,18 +49,26 @@ export async function createMcpServer(context: {
4649
server.registerTool(
4750
'list_projects',
4851
{
49-
title: 'List projects',
52+
title: 'List Angular Projects',
5053
description:
51-
'List projects within an Angular workspace.' +
52-
' This information is read from the `angular.json` file at the root path of the Angular workspace',
54+
'Lists the names of all applications and libraries defined within an Angular workspace. ' +
55+
'It reads the `angular.json` configuration file to identify the projects. ',
56+
annotations: {
57+
readOnlyHint: true,
58+
},
5359
},
54-
() => {
55-
if (!context.workspace) {
60+
async () => {
61+
const { workspace } = context;
62+
63+
if (!workspace) {
5664
return {
5765
content: [
5866
{
59-
type: 'text',
60-
text: 'Not within an Angular project.',
67+
type: 'text' as const,
68+
text:
69+
'No Angular workspace found.' +
70+
' An `angular.json` file, which marks the root of a workspace,' +
71+
' could not be located in the current directory or any of its parent directories.',
6172
},
6273
],
6374
};
@@ -66,10 +77,8 @@ export async function createMcpServer(context: {
6677
return {
6778
content: [
6879
{
69-
type: 'text',
70-
text:
71-
'Projects in the Angular workspace: ' +
72-
[...context.workspace.projects.keys()].join(','),
80+
type: 'text' as const,
81+
text: 'Projects in the Angular workspace: ' + [...workspace.projects.keys()].join(','),
7382
},
7483
],
7584
};

0 commit comments

Comments
 (0)