Skip to content

Commit bc87c85

Browse files
committed
fix(@angular/cli): update MCP devserver tool names to conform to spec regex
MCP tool names must adhere to the regular expression ^[a-zA-Z0-9_-]+$. This commit updates devserver.start, devserver.stop, and devserver.wait_for_build to use underscores (devserver_start, devserver_stop, devserver_wait_for_build) and updates all corresponding tool references and documentation across the MCP command package. (cherry picked from commit e12e002)
1 parent 212a7bb commit bc87c85

5 files changed

Lines changed: 17 additions & 17 deletions

File tree

packages/angular/cli/src/commands/mcp/tools/devserver/devserver-start.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,29 +93,29 @@ export const DEVSERVER_START_TOOL: McpToolDeclaration<
9393
typeof devserverStartToolInputSchema.shape,
9494
typeof devserverStartToolOutputSchema.shape
9595
> = declareTool({
96-
name: 'devserver.start',
96+
name: 'devserver_start',
9797
title: 'Start Development Server',
9898
description: `
9999
<Purpose>
100-
Starts the Angular development server ("ng serve") as a background process. Follow this up with "devserver.wait_for_build" to wait until
100+
Starts the Angular development server ("ng serve") as a background process. Follow this up with "devserver_wait_for_build" to wait until
101101
the first build completes.
102102
</Purpose>
103103
<Use Cases>
104104
* **Starting the Server:** Use this tool to begin serving the application. The tool will return immediately while the server runs in the
105105
background.
106-
* **Get Initial Build Logs:** Once a dev server has started, use the "devserver.wait_for_build" tool to ensure it's alive. If there are any
107-
build errors, "devserver.wait_for_build" would provide them back and you can give them to the user or rely on them to propose a fix.
108-
* **Get Updated Build Logs:** Important: as long as a devserver is alive (i.e. "devserver.stop" wasn't called), after every time you
109-
make a change to the workspace, re-run "devserver.wait_for_build" to see whether the change was successfully built and wait for the
106+
* **Get Initial Build Logs:** Once a dev server has started, use the "devserver_wait_for_build" tool to ensure it's alive. If there are any
107+
build errors, "devserver_wait_for_build" would provide them back and you can give them to the user or rely on them to propose a fix.
108+
* **Get Updated Build Logs:** Important: as long as a devserver is alive (i.e. "devserver_stop" wasn't called), after every time you
109+
make a change to the workspace, re-run "devserver_wait_for_build" to see whether the change was successfully built and wait for the
110110
devserver to be updated.
111111
</Use Cases>
112112
<Operational Notes>
113113
* This tool manages development servers by itself. It maintains at most a single dev server instance for each project in the monorepo.
114114
* This is an asynchronous operation. Subsequent commands can be ran while the server is active.
115-
* Use 'devserver.stop' to gracefully shut down the server and access the full log output.
115+
* Use 'devserver_stop' to gracefully shut down the server and access the full log output.
116116
* **Keeping the Server Alive**: It is often better to keep the server alive between tool calls if you expect the user to request more
117117
changes or run more tests, as it saves time on restarts and maintains the file watcher state. You must still call
118-
'devserver.wait_for_build' after every change to see whether the change was successfully built and be sure that that app was updated.
118+
'devserver_wait_for_build' after every change to see whether the change was successfully built and be sure that the app was updated.
119119
* **Consistent Ports**: If making multiple calls, it is recommended to reuse the port you got from the first call for subsequent ones.
120120
</Operational Notes>
121121
`,

packages/angular/cli/src/commands/mcp/tools/devserver/devserver-stop.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ export const DEVSERVER_STOP_TOOL: McpToolDeclaration<
5454
typeof devserverStopToolInputSchema.shape,
5555
typeof devserverStopToolOutputSchema.shape
5656
> = declareTool({
57-
name: 'devserver.stop',
57+
name: 'devserver_stop',
5858
title: 'Stop Development Server',
5959
description: `
6060
<Purpose>
61-
Stops a running Angular development server ("ng serve") that was started with the "devserver.start" tool.
61+
Stops a running Angular development server ("ng serve") that was started with the "devserver_start" tool.
6262
</Purpose>
6363
<Use Cases>
6464
* **Stopping the Server:** Use this tool to terminate a running development server and retrieve the logs.

packages/angular/cli/src/commands/mcp/tools/devserver/devserver-wait-for-build.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,22 @@ export const DEVSERVER_WAIT_FOR_BUILD_TOOL: McpToolDeclaration<
9696
typeof devserverWaitForBuildToolInputSchema.shape,
9797
typeof devserverWaitForBuildToolOutputSchema.shape
9898
> = declareTool({
99-
name: 'devserver.wait_for_build',
99+
name: 'devserver_wait_for_build',
100100
title: 'Wait for Devserver Build',
101101
description: `
102102
<Purpose>
103-
Waits for a dev server that was started with the "devserver.start" tool to complete its build, then reports the build logs from its most
103+
Waits for a dev server that was started with the "devserver_start" tool to complete its build, then reports the build logs from its most
104104
recent build.
105105
</Purpose>
106106
<Use Cases>
107-
* **Waiting for a build:** As long as a devserver is alive ("devserver.start" was called for this project and "devserver.stop" wasn't
107+
* **Waiting for a build:** As long as a devserver is alive ("devserver_start" was called for this project and "devserver_stop" wasn't
108108
called yet), then if you're making a file change and want to ensure it was successfully built, call this tool instead of any other build
109109
tool or command. When it retuns you'll get build logs back **and** you'll know the user's devserver is up-to-date with the latest changes.
110110
</Use Cases>
111111
<Operational Notes>
112-
* This tool expects that a dev server was launched on the same project with the "devserver.start" tool, otherwise the tool will fail.
112+
* This tool expects that a dev server was launched on the same project with the "devserver_start" tool, otherwise the tool will fail.
113113
* This tool will block until the build is complete or the timeout is reached. If you expect a long build process, consider increasing the
114-
timeout. Timeouts on initial run (right after "devserver.start" calls) or after a big change are not necessarily indicative of an error.
114+
timeout. Timeouts on initial run (right after "devserver_start" calls) or after a big change are not necessarily indicative of an error.
115115
* If you encountered a timeout and it might be reasonable, just call this tool again.
116116
* If the dev server is not building, it will return quickly, with the logs from the last build.
117117
</Operational Notes>

packages/angular/cli/src/commands/mcp/tools/run-target/generic-target-strategy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class GenericTargetStrategy implements TargetStrategy {
3434
if (input.targetName === 'serve' || input.options?.['watch'] === true) {
3535
throw new Error(
3636
`Watch mode execution (serve target or watch option) is not yet supported by 'run_target'. ` +
37-
`Please use the legacy 'devserver.start' / 'devserver.wait_for_build' tools instead.`,
37+
`Please use the legacy 'devserver_start' / 'devserver_wait_for_build' tools instead.`,
3838
);
3939
}
4040

packages/angular/cli/src/commands/mcp/tools/run-target/run-target.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ This is the single, unified interface for executing all project tasks natively.
6666
and disables watch mode to guarantee clean execution.
6767
* Output Paths: For official builders, successful builds return the build directory in 'outputPath' under the extensions metadata.
6868
* Watch mode (serve target or watch options) is NOT yet supported in this version of run_target.
69-
You MUST use the legacy 'devserver.*' tools for background server lifecycles.
69+
You MUST use the legacy 'devserver_*' tools for background server lifecycles.
7070
</Operational Notes>`,
7171
isReadOnly: false,
7272
isLocalOnly: true,

0 commit comments

Comments
 (0)