diff --git a/packages/cli/src/zed-integration/zedIntegration.ts b/packages/cli/src/zed-integration/zedIntegration.ts index 93a97571a4..1769cbafca 100644 --- a/packages/cli/src/zed-integration/zedIntegration.ts +++ b/packages/cli/src/zed-integration/zedIntegration.ts @@ -31,6 +31,7 @@ import { resolveModel, createWorkingStdio, startupProfiler, + Kind, } from '@google/gemini-cli-core'; import * as acp from '@agentclientprotocol/sdk'; import { AcpFileSystemService } from './fileSystemService.js'; @@ -463,7 +464,7 @@ export class Session { title: invocation.getDescription(), content, locations: invocation.toolLocations(), - kind: tool.kind, + kind: toAcpToolKind(tool.kind), }, }; @@ -502,7 +503,7 @@ export class Session { title: invocation.getDescription(), content: [], locations: invocation.toolLocations(), - kind: tool.kind, + kind: toAcpToolKind(tool.kind), }); } @@ -798,7 +799,7 @@ export class Session { title: invocation.getDescription(), content: [], locations: invocation.toolLocations(), - kind: readManyFilesTool.kind, + kind: toAcpToolKind(readManyFilesTool.kind), }); const result = await invocation.execute(abortSignal); @@ -988,3 +989,25 @@ function toPermissionOptions( } } } + +/** + * Maps our internal tool kind to the ACP ToolKind. + * Fallback to 'other' for kinds that are not supported by the ACP protocol. + */ +function toAcpToolKind(kind: Kind): acp.ToolKind { + switch (kind) { + case Kind.Read: + case Kind.Edit: + case Kind.Delete: + case Kind.Move: + case Kind.Search: + case Kind.Execute: + case Kind.Think: + case Kind.Fetch: + case Kind.Other: + return kind as acp.ToolKind; + case Kind.Communicate: + default: + return 'other'; + } +} diff --git a/packages/core/src/tools/ask-user.ts b/packages/core/src/tools/ask-user.ts index 7075809f9f..7d0fb8ef3a 100644 --- a/packages/core/src/tools/ask-user.ts +++ b/packages/core/src/tools/ask-user.ts @@ -35,7 +35,7 @@ export class AskUserTool extends BaseDeclarativeTool< ASK_USER_TOOL_NAME, 'Ask User', 'Ask the user one or more questions to gather preferences, clarify requirements, or make decisions.', - Kind.Other, + Kind.Communicate, { type: 'object', required: ['questions'], diff --git a/packages/core/src/tools/tools.ts b/packages/core/src/tools/tools.ts index 82a980aeef..32a5e72972 100644 --- a/packages/core/src/tools/tools.ts +++ b/packages/core/src/tools/tools.ts @@ -745,6 +745,7 @@ export enum Kind { Execute = 'execute', Think = 'think', Fetch = 'fetch', + Communicate = 'communicate', Other = 'other', }