From 72db21f5995b28f4a0623bcb60f6dfc74e8ded6d Mon Sep 17 00:00:00 2001 From: hugocasa Date: Wed, 2 Dec 2026 18:11:18 +0100 Subject: [PATCH] fix: shorten the run-and-edit access label, list the edits in its tooltip Co-Authored-By: Claude Opus 5.5 --- .../lib/components/mcp/workspaceAccess.test.ts | 12 ++++++------ .../src/lib/components/mcp/workspaceAccess.ts | 17 ++++++++++------- .../oauth/mcp_authorize/+page@(root).svelte | 3 ++- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/frontend/src/lib/components/mcp/workspaceAccess.test.ts b/frontend/src/lib/components/mcp/workspaceAccess.test.ts index 5658c60751..f3b2d99131 100644 --- a/frontend/src/lib/components/mcp/workspaceAccess.test.ts +++ b/frontend/src/lib/components/mcp/workspaceAccess.test.ts @@ -4,6 +4,7 @@ import { accessLabel, connectsSeparately, defaultConnection, + editsHint, servedOn, toolsetLevel } from './workspaceAccess' @@ -36,12 +37,11 @@ it('names the lower of the picked access and the workspace one', () => { expect(accessLabel({ ...ws('a', 'runnables'), runnables: 12 }, 'full')).toBe( '12 scripts and flows as tools' ) - expect( - accessLabel( - { ...ws('a', 'run_and_edit'), edits: ['variables', 'schedules', 'triggers'] }, - 'full' - ) - ).toBe('Read and run, edit variables, schedules and triggers') + const edits = { ...ws('a', 'run_and_edit'), edits: ['variables', 'schedules', 'triggers'] } + expect(accessLabel(edits, 'full')).toBe('Read, run and edit') + expect(editsHint(edits)).toBe( + 'Explore, run deployed scripts, flows and agents, and edit variables, schedules and triggers.' + ) expect(accessLabel(ws('a', 'run_and_edit'), 'read_run')).toBe('Read and run') expect(accessLabel(ws('a', 'read_only'), 'read_run')).toBe('Read only') expect(accessLabel(ws('a', 'read_only'), 'selected')).toBe('Not available') diff --git a/frontend/src/lib/components/mcp/workspaceAccess.ts b/frontend/src/lib/components/mcp/workspaceAccess.ts index 6ab8e6f85b..00350ee4a2 100644 --- a/frontend/src/lib/components/mcp/workspaceAccess.ts +++ b/frontend/src/lib/components/mcp/workspaceAccess.ts @@ -7,7 +7,7 @@ export type WorkspaceAccess = McpWorkspaceAccess['access'] const LABELS: Record = { build_and_run: 'Build and run', - run_and_edit: 'Read and run', + run_and_edit: 'Read, run and edit', read_and_run: 'Read and run', read_only: 'Read only', runnables: 'Scripts and flows as tools', @@ -40,15 +40,18 @@ export function accessLabel(workspace: McpWorkspaceAccess, picked: McpAccess): s return `${runnables} ${runnables === 1 ? 'script or flow' : 'scripts and flows'} as tools` } if (picked === 'read_run' && access !== 'read_only') return LABELS.read_and_run - if (access === 'run_and_edit') { - const edits = workspace.edits ?? [] - const last = edits.at(-1) - const listed = edits.length > 1 ? `${edits.slice(0, -1).join(', ')} and ${last}` : last - return listed ? `${LABELS.run_and_edit}, edit ${listed}` : LABELS.run_and_edit - } return LABELS[access] } +/** What a role that edits only some kinds lets the client do; the label stays short. */ +export function editsHint(workspace: McpWorkspaceAccess): string | undefined { + const edits = workspace.edits ?? [] + if (workspace.access !== 'run_and_edit' || edits.length === 0) return undefined + const last = edits.at(-1) + const listed = edits.length > 1 ? `${edits.slice(0, -1).join(', ')} and ${last}` : last + return `Explore, run deployed scripts, flows and agents, and edit ${listed}.` +} + /** The covered workspaces a connection serves. One set to scripts and flows as tools is served * only to a connection covering it alone; a read-only one lists it as giving nothing. */ export function servedOn( diff --git a/frontend/src/routes/(root)/(logged)/oauth/mcp_authorize/+page@(root).svelte b/frontend/src/routes/(root)/(logged)/oauth/mcp_authorize/+page@(root).svelte index b4dab5611c..d9916bd546 100644 --- a/frontend/src/routes/(root)/(logged)/oauth/mcp_authorize/+page@(root).svelte +++ b/frontend/src/routes/(root)/(logged)/oauth/mcp_authorize/+page@(root).svelte @@ -24,6 +24,7 @@ import { accessLabel, defaultConnection, + editsHint, givesAnything, servedOn, toolsetLevel, @@ -198,7 +199,7 @@ ? 'Nothing the client can use there with this access.' : isTools(ws[0]) ? 'The scripts and flows your role offers, each as its own tool, and nothing else.' - : ACCESS_HINTS[level ?? access] + : ((level === 'full' && editsHint(ws[0])) || ACCESS_HINTS[level ?? access]) return { label, ws,