feat(plan): add 'communicate' tool kind (#17341)

This commit is contained in:
Jerop Kipruto
2026-01-22 16:38:15 -05:00
committed by GitHub
parent 62dd9b5b3c
commit 50985d38c4
3 changed files with 28 additions and 4 deletions

View File

@@ -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';
}
}

View File

@@ -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'],

View File

@@ -745,6 +745,7 @@ export enum Kind {
Execute = 'execute',
Think = 'think',
Fetch = 'fetch',
Communicate = 'communicate',
Other = 'other',
}