Skip to content

Commit 113c8d6

Browse files
jriekenjoaomoreno
andauthored
more tools picker tweaks (microsoft#249957)
Co-authored-by: João Moreno <[email protected]>
1 parent 935a430 commit 113c8d6

File tree

2 files changed

+34
-21
lines changed

2 files changed

+34
-21
lines changed

src/vs/workbench/contrib/chat/browser/actions/chatContext.ts

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,23 +75,37 @@ class ToolsContextPickerPick implements IChatContextPickerItem {
7575

7676
for (const entry of widget.input.selectedToolsModel.entries.get()) {
7777

78-
const label = entry.toolReferenceName ?? entry.displayName;
79-
const item: Pick = {
80-
toolInfo: ToolDataSource.classify(entry.source),
81-
label,
82-
description: label !== entry.displayName ? entry.displayName : undefined,
83-
asAttachment: (): IChatRequestToolEntry | IChatRequestToolSetEntry => {
84-
return {
85-
kind: entry instanceof ToolSet ? 'toolset' : 'tool',
86-
id: entry.id,
87-
name: entry.displayName,
88-
fullName: entry.displayName,
89-
value: undefined,
90-
};
91-
}
92-
};
93-
94-
items.push(item);
78+
if (entry instanceof ToolSet) {
79+
items.push({
80+
toolInfo: ToolDataSource.classify(entry.source),
81+
label: entry.toolReferenceName,
82+
description: entry.description,
83+
asAttachment: (): IChatRequestToolSetEntry => {
84+
return {
85+
kind: 'toolset',
86+
id: entry.id,
87+
icon: entry.icon,
88+
name: entry.displayName,
89+
value: undefined,
90+
};
91+
}
92+
});
93+
} else {
94+
items.push({
95+
toolInfo: ToolDataSource.classify(entry.source),
96+
label: entry.toolReferenceName ?? entry.displayName,
97+
description: entry.userDescription ?? entry.modelDescription,
98+
asAttachment: (): IChatRequestToolEntry => {
99+
return {
100+
kind: 'tool',
101+
id: entry.id,
102+
icon: ThemeIcon.isThemeIcon(entry.icon) ? entry.icon : undefined,
103+
name: entry.displayName,
104+
value: undefined,
105+
};
106+
}
107+
});
108+
}
95109
}
96110

97111
items.sort((a, b) => {

src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ export async function showToolsPicker(
117117
for (const [toolSetOrTool, picked] of toolsEntries) {
118118

119119
let bucket: BucketPick | undefined;
120-
let description: string | undefined;
121120
const buttons: ActionableButton[] = [];
122121

123122
if (toolSetOrTool.source.type === 'mcp') {
@@ -193,8 +192,8 @@ export async function showToolsPicker(
193192
type: 'item',
194193
picked,
195194
toolset: toolSetOrTool,
196-
label: toolSetOrTool.displayName,
197-
description: description ?? toolSetOrTool.description,
195+
label: toolSetOrTool.toolReferenceName,
196+
description: toolSetOrTool.description,
198197
indented: true,
199198
buttons
200199

@@ -206,7 +205,7 @@ export async function showToolsPicker(
206205
picked,
207206
tool: toolSetOrTool,
208207
label: toolSetOrTool.toolReferenceName ?? toolSetOrTool.displayName,
209-
description: toolSetOrTool.userDescription,
208+
description: toolSetOrTool.userDescription ?? toolSetOrTool.modelDescription,
210209
indented: true,
211210
});
212211
}

0 commit comments

Comments
 (0)