Skip to content

Commit ab7ed0e

Browse files
committed
fix(mcp): keep page tools on the calling page and mask more screenshot fields
Page tools now always answer for the page that registered them, list only page-scoped tools and source scans, and leave other tabs out of their answers. Screenshots mask fields and custom controls by every name attribute. Skills install refuses symbolic links, `since` rejects out of range times, and the docs match the tool lists.
1 parent 62eec10 commit ab7ed0e

19 files changed

Lines changed: 453 additions & 68 deletions

‎apps/docs/src/content/agents/browser-agents.md‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ Each call goes from the page to the devtools server, which runs the same handler
2424

2525
Only tools in the `read` [safety tier](./tools.md#action-tools). Action and destructive tools, such as `navigate`, `fill-form` or `clear-recordings`, never reach the page.
2626

27+
Of the `read` tools, the page registers the ones that answer for one page (they take `page` or `pageId`) and the ones that read your source, such as `get-routes`, `get-components` and `build-meta`. These stay with the [MCP server](./mcp-server.md):
28+
29+
| Tool | Why it stays off the page |
30+
| ---------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
31+
| `list-pages` | It lists every tab that reports. |
32+
| `list-ssr-requests`, `explain-ssr-request`, `list-ssr-overrides`, `list-http-rules`, `analog-server-calls` | They answer about the whole server, for every tab. |
33+
| `screenshot-component` | A page tool answers with text, not an image, and the capture draws the whole component. |
34+
| `highlight` | It draws on the page and changes the selection in open panels. |
35+
| `open-in-panel` | It switches the panels that are open. |
36+
2737
The config decides the rest, as for MCP clients:
2838

2939
| Option | Effect on the page tools |
@@ -37,7 +47,7 @@ See [Configuration](../getting-started/configuration.md#inspectors-and-agent-too
3747

3848
## How the tools answer
3949

40-
- A tool that takes `page` or `pageId` answers for the page that registered it, unless the agent names another page.
50+
- A tool that takes `page` or `pageId` always answers for the page that registered it. A `page` or `pageId` the agent passes is replaced with that page's id, so a page never reads another tab. When the page has not reported that data, the answer says so without naming other tabs.
4151
- The answer is the markdown or JSON an MCP client gets. Secret names, JWTs and bearer tokens are masked, as in every answer. See [Redaction](../security.md).
4252
- Answers over 100,000 characters are cut, with a note to narrow the call.
4353
- A WebMCP call resolves to `{content: [{type: 'text', text}]}`. A refused or failed call rejects with the reason.
@@ -70,7 +80,7 @@ The WebMCP registration carries the `readOnlyHint`, `untrustedContentHint` and `
7080
Without WebMCP, the page only listens for `devtoolstooldiscovery`. It writes nothing to your app's DOM. The [Forms](../inspectors/forms.md) tab leaves these tools out of its WebMCP list, which shows the tools of your app.
7181

7282
<ngmd-callout type="warning" title="Any script on the page can call them">
73-
In-page agents and other scripts can list WebMCP tools and run them. The tools only read, but they read the server's view of your app, including the source scan. Leave <code>agent.browserTools</code> off if your development page loads scripts you don't trust.
83+
In-page agents and other scripts can list WebMCP tools and run them. The tools don't change your app's data, but they read the server's view of your page, including the source scan, and <code>inspect-component</code> selects the instance it reads in open panels. Leave <code>agent.browserTools</code> off if your development page loads scripts you don't trust.
7484
</ngmd-callout>
7585

7686
## Where to next

‎apps/docs/src/content/agents/tools.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,12 @@ An image of one component's host element as the page renders it now. The answer
292292
| Argument | Required | Value |
293293
| ---------- | -------- | ------------------------------------------------------------------------------------------------------------- |
294294
| `selector` | yes | An instance id from the `component-tree` resource (like `c12`), a class name, a host tag or any CSS selector. |
295+
| `page` | no | The page id, from `list-pages`. Defaults to the most recent page. |
295296
| `pageId` | no | Same as `page`. |
296297

297298
The page draws a copy of the element, not the screen: it copies the element's DOM with every computed style written inline into an SVG, and draws that on a canvas that is never added to the page. Nothing in the app changes, no app code runs, and a component scrolled out of view or behind a dialog is drawn all the same. A class name or tag that matches several instances captures the first and lists the ids of all of them. A CSS selector captures the first element it matches on the most recent page, or on `page`.
298299

299-
The copy masks what the [redaction](../security.md) masks in form values: password fields, fields whose name, `formControlName` or `id` looks secret (plus `redaction.secretNames`), and fields with a secret `autocomplete`. Elements marked `data-private`, `.sentry-mask`, `.rr-mask` or `data-pangular="mask"` become grey blocks, and `data-pangular="unmask"` keeps a field. JWTs, bearer tokens and secret `key=value` pairs in text are masked too.
300+
The copy masks what the [redaction](../security.md) masks in form values: password fields, fields where any of `formControlName`, `ng-reflect-name`, `name` or `id` looks secret (plus `redaction.secretNames`), and fields with a secret `autocomplete`. Any other element named that way, such as a custom form control `<app-pin formControlName="pin">`, becomes a grey block with everything inside it, its inputs included. Elements marked `data-private`, `.sentry-mask`, `.rr-mask` or `data-pangular="mask"` become grey blocks, and `data-pangular="unmask"` keeps a field. JWTs, bearer tokens and secret `key=value` pairs in text are masked too.
300301

301302
What the copy can't show:
302303

‎apps/docs/src/content/getting-started/configuration.md‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,12 @@ interface PangularConfig {
129129

130130
### Inspectors and agent tools
131131

132-
| Option | Default | What it does |
133-
| -------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
134-
| `inspectors.<name>` | `true` | `false` removes the inspector: no tab or dock, no page collector, no RPC functions, and no agent tools or resources. Its actions are blocked too. |
135-
| `agent.readOnly` | `false` | `true` keeps only the agent tools in the `read` [safety tier](../agents/tools.md#action-tools). It drops `form-action`, `fill-form`, `navigate`, `dispatch-ngrx-action`, `set-http-rule`, `remove-http-rule`, `set-component-property`, `set-signal`, `record-pipes`, `track-subscriptions`, `analog-call-api` and `clear-recordings`. `change-detection` stays without its `record` argument. |
136-
| `agent.tools.<name>` | `true` | `false` hides one inspector's agent tools and resources, and its [shared-state keys](../agents/resources.md#shared-state) over HTTP MCP. The tab stays. |
137-
| `agent.browserTools` | `false` | `true` registers the `read` agent tools on the page for [browser agents](../agents/browser-agents.md) (WebMCP and Chrome DevTools for agents). Off by default, because any script on the development page could then call them. |
132+
| Option | Default | What it does |
133+
| -------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
134+
| `inspectors.<name>` | `true` | `false` removes the inspector: no tab or dock, no page collector, no RPC functions, and no agent tools or resources. Its actions are blocked too. |
135+
| `agent.readOnly` | `false` | `true` keeps only the agent tools in the `read` [safety tier](../agents/tools.md#action-tools). It drops every `action` and `destructive` tool in the [tier table](../agents/tools.md#action-tools): `form-action`, `fill-form`, `navigate`, `dispatch-ngrx-action`, `set-http-rule`, `remove-http-rule`, `set-ssr-override`, `remove-ssr-override`, `set-component-property`, `set-signal`, `watch-signal`, `record-pipes`, `track-subscriptions`, `analog-call-api` and `clear-recordings`. `change-detection` stays without its `record` argument, and `hydration` without its `overlay` argument. |
136+
| `agent.tools.<name>` | `true` | `false` hides one inspector's agent tools and resources, and its [shared-state keys](../agents/resources.md#shared-state) over HTTP MCP. The tab stays. |
137+
| `agent.browserTools` | `false` | `true` registers the `read` agent tools on the page for [browser agents](../agents/browser-agents.md) (WebMCP and Chrome DevTools for agents). Off by default, because any script on the development page could then call them. |
138138

139139
`agent.tools` has the same keys as `inspectors`. An inspector that is off has no agent tools, whatever `agent.tools` says.
140140

@@ -144,15 +144,15 @@ If you open a tab that is turned off, the panel says so, shows the option that t
144144

145145
Actions are the writes that the panel and agents make to your app or the server.
146146

147-
| Option | Default | What `false` blocks |
148-
| -------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
149-
| `actions.forms` | `true` | Form writes: set value, fill, mark touched, untouched, dirty or pristine, touch all, revalidate, reset, enable, disable, submit and restore. Drops `form-action` and `fill-form`. |
150-
| `actions.router` | `true` | Navigate, abort, replay and probe, and clearing the navigations list. Drops router clearing in `clear-recordings`. The `navigate` agent tool stays for `instrument` and `resolve-lazy` and refuses the other four. |
151-
| `actions.ngrx` | `true` | Restoring NgRx state from the change log and dispatching `@ngrx/store` actions. Drops the `dispatch-ngrx-action` agent tool. |
152-
| `actions.http` | `true` | Editing fault injection rules and SSR overrides, and clearing the HTTP timeline. Drops the `set-http-rule` and `remove-http-rule` agent tools and HTTP clearing in `clear-recordings`. |
153-
| `actions.analog` | `true` | The Analog request playground and clearing server calls. Drops the `analog-call-api` agent tool and Analog clearing in `clear-recordings`. |
154-
| `actions.components` | `true` | Editing component inputs, properties and writable signals from the **Components** tab. Drops the `set-component-property` and `set-signal` agent tools. |
155-
| `actions` | `true` | All of the above. |
147+
| Option | Default | What `false` blocks |
148+
| -------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
149+
| `actions.forms` | `true` | Form writes: set value, fill, mark touched, untouched, dirty or pristine, touch all, revalidate, reset, enable, disable, submit and restore. Drops `form-action` and `fill-form`. |
150+
| `actions.router` | `true` | Navigate, abort, replay and probe, and clearing the navigations list. Drops router clearing in `clear-recordings`. The `navigate` agent tool stays for `instrument` and `resolve-lazy` and refuses the other four. |
151+
| `actions.ngrx` | `true` | Restoring NgRx state from the change log and dispatching `@ngrx/store` actions. Drops the `dispatch-ngrx-action` agent tool. |
152+
| `actions.http` | `true` | Editing fault injection rules and SSR overrides, and clearing the HTTP timeline. Drops the `set-http-rule`, `remove-http-rule`, `set-ssr-override` and `remove-ssr-override` agent tools and HTTP clearing in `clear-recordings`. |
153+
| `actions.analog` | `true` | The Analog request playground and clearing server calls. Drops the `analog-call-api` agent tool and Analog clearing in `clear-recordings`. |
154+
| `actions.components` | `true` | Editing component inputs, properties and writable signals from the **Components** tab. Drops the `set-component-property` and `set-signal` agent tools. |
155+
| `actions` | `true` | All of the above. |
156156

157157
Pass `actions: false` to block every action, or an object to block some. Keys you leave out of the object stay on.
158158

‎apps/docs/src/content/inspectors/components.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ Press Escape in the filter box to clear it. When the filter matches nothing, **C
455455
| `pangular:list-components` | tool | Returns the live tree of one page as an indented outline with routed, directive host and hydration markers. Takes a `filter` with the search syntax, a `depth` and `directiveHosts`. |
456456
| `pangular:defer-blocks` | tool | Lists the `@defer` blocks of each page, and flags blocks that failed, blocks stuck on their placeholder and blocks still dehydrated. |
457457
| `pangular:for-blocks` | tool | Lists the `@for` blocks of each page with their item count, track kind and `@empty` block. |
458-
| `pangular:hydration` | tool | Returns the hydration status of each page rendered on the server, and turns the outline on the page on or off. An action when it turns the outline on or off. |
458+
| `pangular:hydration` | tool | Returns the hydration status of each page rendered on the server, and turns the outline on the page on or off. Turning the outline on or off is an action. |
459459
| `pangular:change-detection` | tool | Starts, stops or clears a change detection recording, turns the live views on or off, and returns the slowest and most often checked components, hook, output and afterRender time, the latest cycles, or an export. |
460460
| `pangular:diagnose-change-detection` | tool | What started the recorded cycles, components that depend on zone.js, wasted checks, inputs that break OnPush, and OnPush hints. |
461461
| `pangular:set-component-property` | tool | Writes an input or property of one instance and runs change detection. An action. |

0 commit comments

Comments
 (0)