From e2fcf4f4ba32211623b6b936236229d4ef7028cb Mon Sep 17 00:00:00 2001 From: ZhuchkaTriplesix Date: Fri, 9 Oct 2026 14:21:59 +0300 Subject: [PATCH] feat(mcp): the activity list names the rule that refused a call (#1231) A refused call showed only its error text in Settings. Its refusal rule now shows under it, so the list says which rule caught the query, as the audit log does. --- lib/features/settings/preferences_mcp_section.dart | 5 +++++ test/features/settings/preferences_mcp_section_test.dart | 2 ++ 2 files changed, 7 insertions(+) diff --git a/lib/features/settings/preferences_mcp_section.dart b/lib/features/settings/preferences_mcp_section.dart index 48a09c71..c4300c39 100644 --- a/lib/features/settings/preferences_mcp_section.dart +++ b/lib/features/settings/preferences_mcp_section.dart @@ -349,6 +349,11 @@ class _ActivityRow extends material.StatelessWidget { style: material.TextStyle( color: entry.error != null ? wb.destructive : wb.mutedForeground), ).xSmall(), + // The guard rule that refused the call, when one did. + if (entry.refusalRule != null) + Text('refused by ${entry.refusalRule}') + .xSmall() + .muted(), ], ), ); diff --git a/test/features/settings/preferences_mcp_section_test.dart b/test/features/settings/preferences_mcp_section_test.dart index 1c64c521..e07200e2 100644 --- a/test/features/settings/preferences_mcp_section_test.dart +++ b/test/features/settings/preferences_mcp_section_test.dart @@ -184,6 +184,7 @@ void main() { sqlText: 'DELETE FROM orders', durationMs: 1, error: 'Data-modifying statements are not allowed over MCP.', + refusalRule: 'data_modifying', ), ]; await pump(tester); @@ -192,6 +193,7 @@ void main() { expect(find.text('1 row(s) ยท 12 ms'), findsOneWidget); expect(find.text('Data-modifying statements are not allowed over MCP.'), findsOneWidget); + expect(find.text('refused by data_modifying'), findsOneWidget); await tester.tap(find.byKey(const material.ValueKey('mcp_clear_log'))); await tester.pump();