server, ui: only offer a working directory when a tool reads it (#26762)

The working directory chip showed up as soon as the server exposed any
builtin tool, so a server started with just get_datetime, or a user who
turned every filesystem tool off in the settings, still got a control
that nothing would read.

Tools now declare whether they resolve their paths and run against the
working directory, next to the write permission they already publish in
the /tools listing. The WebUI shows the chip and enables the /cwd
command only when at least one such tool is both served and left
enabled.
This commit is contained in:
Pascal
2026-08-08 16:36:21 +02:00
committed by GitHub
parent dd2c7c4471
commit 18f7ad7fc9
8 changed files with 38 additions and 7 deletions
@@ -24,7 +24,7 @@ export interface UseChatFormPickersOptions {
/** Gates `/prompt`. */
hasPrompts: () => boolean;
/** Gates `/cwd`. */
hasBuiltinTools: () => boolean;
hasCwdTools: () => boolean;
getCwd: () => string | null;
/** Mention search fallback scope. */
getServerHome: () => string | null;
@@ -63,7 +63,7 @@ export function useChatFormPickers(opts: UseChatFormPickersOptions) {
getChatCommands({
showModelSelector: opts.getShowModelSelector(),
hasPrompts: opts.hasPrompts,
hasBuiltinTools: opts.hasBuiltinTools
hasCwdTools: opts.hasCwdTools
})
);