Repository navigation
mcp: fixes and improvements for agent tools, lint rules and error capture #358
Copy link
Copy link
Closed
Labels
bugSomething is broken or shows wrong dataSomething is broken or shows wrong datafeatureA feature request or a pull request that adds oneA feature request or a pull request that adds one
Description
Context
Fixes and improvements from a code audit of agent tool design, lint rules and error capture, done in October 2026. Roadmap work lives in #340, #341, #342 and #343. Items marked (to confirm) were not reproduced; check them before fixing.
Agent tool design
Problems
Low
- No tool titles or structured output: no
agent.registerToolcall indevframe.tssetstitle, so MCP clients show raw ids such aspangular:list-http-callsfor most tools; only the RPC-backed tools (for exampleget-components.ts:44,build-meta.ts:28) have one. No tool setstagsoroutputSchema, and every live tool returns markdown only. Add a shorttitleand per-inspectortagsto each tool, and returnstructuredContentnext to the markdown for the list tools (list-pages,list-http-calls,list-components) so agents get stable ids without parsing text (packages/devtools/src/devframe.ts:909,1743,2281). - Undeclared
pageon form tools:form-actionandfill-formcallunknownFormPage(args), which readspage, but neitherinputSchemadeclares it, so clients never send it and the check is dead. Addpage: PAGE_ARGUMENTto both schemas or remove the check (packages/devtools/src/devframe.ts:2798,2851,2425). - Inconsistent page argument:
highlight,inspect-component,defer-blocksandinspect-providersstill accept apageIdalias next topage, while the others take onlypage. UsePAGE_ARGUMENTeverywhere and drop thepageIdaliases in a minor release (packages/devtools/src/devframe.ts:1761,1825,1914,2100). - Uncapped raw resources: the
component-tree,signal-graph,injector-treeandngrx-storeresources returnJSON.stringify(state, null, 2)of every page, with no size cap and no untrusted-data notice, although the strings come from the page. Cap the size, drop the indentation and add theUNTRUSTEDnotice (or an_untrustedfield) (packages/devtools/src/devframe.ts:1616,1625,1634,1643). - Panel-only actions:
clear-http-calls,clear-router-navigations,analog-clear-callsandrequest-component-pickhave no agent tool, so an agent can't reset recorded data between repro runs. Add aclear-recordingstool (http, router, analog) gated by the matchingactions.*, and list it inACTION_TOOLSandAGENT_INSPECTORand inagents/tools.md(packages/devtools/src/devframe.ts:623,833,1355,packages/devtools/src/rpc/analog-register.ts:227). -
analog-call-apipath not described:pathhas no description and nothing says it must be a same-origin path starting with/, so agents guess whether to pass a full URL. Describepath,methodandbody, and spell out theconfirmrule in the schema (packages/devtools/src/rpc/analog-register.ts:351-358).
Improvements
- Generate
AGENT_INSPECTOR,ACTION_TOOLSandPAGE_AGENT_ENTRIESfrom metadata on eachregisterToolcall (inspector, action, needs page) instead of three hand-kept lists, so a new tool can't be left out (packages/devtools/src/config.ts:407,495,548,packages/devtools/src/devframe.ts). - Add MCP prompts for common workflows ("debug an invalid form", "why didn't this route load", "find slow change detection"), each chaining
list-pageswith the inspect and explain tools (packages/devtools/src/devframe.ts). - Turn the six resources into per-page resource templates (
pangular://page/{pageId}/component-tree) and sendresources/list_changedwhen a page connects or expires, so clients can subscribe instead of polling (packages/devtools/src/devframe.ts:1610-1662). - Add a general
wait-fortool (app stable, navigation end, HTTP idle,@defercomplete) that generalizeswait-for-formandnavigate'swaitFor: 'stable'(packages/devtools/src/devframe.ts:2730,2281). - Add a "snapshot everything" export tool (component tree, route, forms, HTTP, NgRx) for bug reports, next to the existing
export-formandexport-navigation(packages/devtools/src/devframe.ts:2241,2714). - Keep tool descriptions under about 600 characters.
inspect-forms,navigateand thengrx-storeresource run past 1,000, which costs context in every client's tool list (packages/devtools/src/devframe.ts:1638,2281,2437). - Add a module and lazy-chunk graph tool through the Vite plugin, as vite-plugin-mcp does (
packages/devtools/src/vite.ts).
Already tracked elsewhere
devframe_state_readanddevframe://stateexpose data of inspectors turned off for agents: mcp: agent.tools.<inspector>=false still exposes the inspector's data through devframe_state_read #238, phase 1 of 4: safe by default and wired into your workflow #340.agent.readOnlykeeps tools of adestructivetier: phase 1 of 4: safe by default and wired into your workflow #340 (three safety tiers).- Writes such as submit, restore, dispatch and non-GET API calls are not marked
destructive: phase 1 of 4: safe by default and wired into your workflow #340. - Inconsistent safety classes (
highlight,record-pipes,change-detection,navigate, emptyACTION_TOOLS.router): phase 1 of 4: safe by default and wired into your workflow #340. - Missing errors, console, screenshot and open-in-editor tools: phase 1 of 4: safe by default and wired into your workflow #340, phase 3 of 4: a shell you live in #342, phase 4 of 4: deeper diagnosis #343. NgRx restore and SSR override agent tools: phase 4 of 4: deeper diagnosis #343.
Lint rules and error capture
Problems
Medium
- email-in-url leaks the email: the finding sets
route: emailed.url, so the address the rule warns about is sent to the panel and agents.redactUrldoes not mask email addresses, so the same URL also shows in the navigation list. Mask emails in the finding (for example[email]), or report the route pattern only, and consider masking emails inredactUrltoo (packages/devtools/src/rpc/router-config-tools.ts:530-536,packages/devtools/src/router.ts:290).
Low
- forms rejection attribution: while
submittingFormis set, anyunhandledrejectionon the page is recorded as athrewsubmit event for that form, even when it is unrelated. Attribute only rejections that come from the submission action, for example by wrapping the action's promise (packages/devtools/src/forms-collector.ts:329,349,608-622). - hydration capture redacts first: the HTTP hydration console patch runs
redactMessageover up to 5000 characters on everyconsole.warnandconsole.error, beforeisHydrationMessagechecks the text. Check first, then redact (packages/devtools/src/http.ts:355-359). - impure-pipe-in-for misses
*ngFor:forBlocksonly matches@for (, so templates that still use*ngFornever get the finding. Also match*ngForhost elements, or parse templates with@angular/compilerparseTemplate(packages/devtools/src/rpc/pipe-lint.ts:108-123). - forms NG code regex:
setupErrorOfuses/NG0?1\d{3}/with no word boundary, so it also matchesNG1xxxand codes inside longer tokens, while the hydration regex uses\b. Use/\bNG01\d{3}\b[^\n]*/and share one NG code parser (packages/devtools/src/forms-collector.ts:95-103).
Improvements
- Server-side errors: capture SSR render errors in the SSR middleware and Vite dev-server errors in the Vite plugin, so agents see compile and SSR failures (
packages/devtools/src/ssr-middleware.ts,packages/devtools/src/vite.ts). - Template diagnostics: run Angular's extended diagnostics (nullish coalescing on a non-nullable value, signal not invoked in an interpolation, missing control flow import) through the Vite plugin and expose them as a
lint-templatesagent tool, registered inconfig.ts(packages/devtools/src/vite.ts,packages/devtools/src/config.ts). - Perf collector:
PerformanceObserverfor LCP, CLS, INP and long tasks, with long tasks matched to change detection cycles, and findings in the shared{ rule, severity, fix }shape, including a missing or$index@fortrack rule (packages/devtools/src/cd-recorder.ts,packages/devtools/src/rpc/cd-tools.ts). - Lazy chunk sizes from the Vite or esbuild metafile, reported per lazy route (
packages/devtools/src/vite.ts,packages/devtools/src/rpc/router-config-tools.ts). - Let users turn rules off in the devtools config (
lint: { rules: { 'missing-title': 'off' } }), applied by every lint tool and documented inapps/docs(packages/devtools/src/config.ts,packages/devtools/src/rpc/forms-lint.ts,packages/devtools/src/rpc/pipe-lint.ts,packages/devtools/src/rpc/router-config-tools.ts). - JSON and SARIF export of lint findings for CI, through the CLI (
packages/devtools/src/cli.ts).
Already tracked elsewhere
- Runtime error capture (
ErrorHandler,error,unhandledrejection, NG0xxx codes, errors panel and agent tools): phase 3 of 4: a shell you live in #342. - Replacing the three stacked console patches with one shared console tap: phase 3 of 4: a shell you live in #342.
- An axe pass over the inspected app: phase 4 of 4: deeper diagnosis #343.
- One audit entry point with a single list of findings across lint tools: phase 4 of 4: deeper diagnosis #343.
Generated by Claude Code
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething is broken or shows wrong dataSomething is broken or shows wrong datafeatureA feature request or a pull request that adds oneA feature request or a pull request that adds one
Activity
fix: audit findings for agent tools, code health and setup (#363)
feat(mcp): add clear-recordings agent tool (#365)