From fc23165c333901394a396d339dcdfb901ab2adc9 Mon Sep 17 00:00:00 2001 From: hugocasa Date: Wed, 2 Dec 2026 19:47:30 +0100 Subject: [PATCH] fix: one tool list per connection, fold the workspaces that connect on their own Co-Authored-By: Claude Opus 5.5 --- .../oauth/mcp_authorize/+page@(root).svelte | 145 +++++++++--------- 1 file changed, 72 insertions(+), 73 deletions(-) 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 1898273552..b2e61dcbea 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 @@ -43,6 +43,8 @@ import { sendUserToast } from '$lib/toast' import { copyToClipboard } from '$lib/utils' import Pencil from 'lucide-svelte/icons/pencil' + import ChevronDown from 'lucide-svelte/icons/chevron-down' + import ChevronRight from 'lucide-svelte/icons/chevron-right' import Copy from 'lucide-svelte/icons/copy' import Check from 'lucide-svelte/icons/check' @@ -184,7 +186,7 @@ isGateway && !toolsOnly && !allWorkspaces && covered.length === 1 && isTools(covered[0]) ) const leftOut = $derived( - isGateway && !toolsOnly && access !== 'selected' && access !== 'read' + isGateway && access !== 'selected' && access !== 'read' ? workspaceAccess.filter((w) => isTools(w) && !served.includes(w)) : [] ) @@ -198,18 +200,15 @@ return [...byLabel].map(([key, ws]) => { const label = accessLabel(ws[0], access) const level = toolsetLevel(ws[0], access) - const hint = - !givesAnything(ws[0], access) - ? '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] + const hint = !givesAnything(ws[0], access) + ? '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] return { key, label, ws, - // One list per connection: the picked level's, or what a bound workspace leaves. - tools: givesAnything(ws[0], access) ? connectionToolset(access, bound) : undefined, restricted: restriction(ws[0], access), hint: ws.every((w) => w.limited) ? `${hint} Set by your role.` : hint } @@ -217,8 +216,12 @@ }) // A role limit settles the access; a narrower one the client asked for stays editable. const editable = $derived(served.every((w) => !w.limited) || access !== 'full') - let shownTools = $state([]) - let showUrls = $state(false) + // One tool list per connection: the picked level's, or what a bound workspace leaves. + const connectionTools = $derived( + served.some((w) => givesAnything(w, access)) ? connectionToolset(access, bound) : undefined + ) + let toolsOpen = $state(false) + let leftOutOpen = $state(false) function coverDefault() { const initial = defaultConnection(workspaceAccess) allWorkspaces = initial.all @@ -514,23 +517,8 @@ placeholder="Choose a workspace" />

- Your role gives scripts and flows as tools, one workspace per connection. For another, - sign in again and choose it here, or add its URL to your client. + Your role gives scripts and flows as tools, one workspace per connection.

- - {#if showUrls} - {#each workspaceAccess.filter((w) => isTools(w) && !pickedWorkspaces.includes(w.id)) as w (w.id)} - - {/each} - {/if} {:else if toolsAlone}

{covered[0].name} only

+ {/if} + {/snippet} {#snippet accessRow(group: (typeof groups)[number], named: boolean)} - {@const open = shownTools.includes(group.key)}
@@ -626,24 +625,9 @@ {/if} {group.hint} - {#if !named}{@render pen()}{/if} - {#if group.tools} - {@const tools = open ? toolset(group.tools) : undefined} - - {#if open} -
- {/if} + {#if !named} + {@render pen()} + {@render toolsToggle()} {/if}
@@ -653,7 +637,10 @@

Access

- {#if groups.length !== 1}{@render pen()}{/if} + {#if groups.length !== 1} + {@render pen()} + {@render toolsToggle()} + {/if}
{#if groups.length === 1} {@render accessRow(groups[0], false)} @@ -668,42 +655,54 @@ Scripts and flows as tools. Choose the workspace and its scripts and flows.

{/if} + {#if toolsOpen && connectionTools} + + {/if}
{/if} {#if leftOut.length > 0} {@const one = leftOut.length === 1}
-

+ + {#if leftOutOpen} +

+ Scripts and flows as tools need a connection of their own. +

+ {#each leftOut as w (w.id)} +
+
+

+ Add {one ? 'its' : `${w.name}'s`} URL to your AI client +

+ +
+
+

Or connect only {w.name} here

+

In place of the other workspaces.

+ +
-
-

Or connect only {w.name} here

-

In place of the other workspaces.

- -
-
- {/each} + {/each} + {/if} {/if}