Update /tools desc to show the name of each tool as known to the model (#1091)
This commit is contained in:
parent
197704c630
commit
40fbb61a1b
|
@ -606,8 +606,8 @@ Add any other context about the problem here.
|
||||||
|
|
||||||
// Should only show tool1 and tool2, not the MCP tools
|
// Should only show tool1 and tool2, not the MCP tools
|
||||||
const message = mockAddItem.mock.calls[1][0].text;
|
const message = mockAddItem.mock.calls[1][0].text;
|
||||||
expect(message).toContain('\u001b[36mTool1\u001b[0m');
|
expect(message).toContain('Tool1');
|
||||||
expect(message).toContain('\u001b[36mTool2\u001b[0m');
|
expect(message).toContain('Tool2');
|
||||||
expect(commandResult).toBe(true);
|
expect(commandResult).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -664,9 +664,9 @@ Add any other context about the problem here.
|
||||||
});
|
});
|
||||||
|
|
||||||
const message = mockAddItem.mock.calls[1][0].text;
|
const message = mockAddItem.mock.calls[1][0].text;
|
||||||
expect(message).toContain('\u001b[36mTool1\u001b[0m');
|
expect(message).toContain('Tool1');
|
||||||
expect(message).toContain('Description for Tool1');
|
expect(message).toContain('Description for Tool1');
|
||||||
expect(message).toContain('\u001b[36mTool2\u001b[0m');
|
expect(message).toContain('Tool2');
|
||||||
expect(message).toContain('Description for Tool2');
|
expect(message).toContain('Description for Tool2');
|
||||||
expect(commandResult).toBe(true);
|
expect(commandResult).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
|
@ -473,25 +473,18 @@ export const useSlashCommandProcessor = (
|
||||||
geminiTools.forEach((tool) => {
|
geminiTools.forEach((tool) => {
|
||||||
if (useShowDescriptions && tool.description) {
|
if (useShowDescriptions && tool.description) {
|
||||||
// Format tool name in cyan using simple ANSI cyan color
|
// Format tool name in cyan using simple ANSI cyan color
|
||||||
message += ` - \u001b[36m${tool.displayName}\u001b[0m: `;
|
message += ` - \u001b[36m${tool.displayName} (${tool.name})\u001b[0m:\n`;
|
||||||
|
|
||||||
// Apply green color to the description text
|
// Apply green color to the description text
|
||||||
const greenColor = '\u001b[32m';
|
const greenColor = '\u001b[32m';
|
||||||
const resetColor = '\u001b[0m';
|
const resetColor = '\u001b[0m';
|
||||||
|
|
||||||
// Handle multi-line descriptions by properly indenting and preserving formatting
|
// Handle multi-line descriptions by properly indenting and preserving formatting
|
||||||
const descLines = tool.description.split('\n');
|
const descLines = tool.description.trim().split('\n');
|
||||||
message += `${greenColor}${descLines[0]}${resetColor}\n`;
|
|
||||||
|
|
||||||
// If there are multiple lines, add proper indentation for each line
|
// If there are multiple lines, add proper indentation for each line
|
||||||
if (descLines.length > 1) {
|
if (descLines) {
|
||||||
for (let i = 1; i < descLines.length; i++) {
|
for (let i = 0; i < descLines.length; i++) {
|
||||||
// Skip empty lines at the end
|
|
||||||
if (
|
|
||||||
i === descLines.length - 1 &&
|
|
||||||
descLines[i].trim() === ''
|
|
||||||
)
|
|
||||||
continue;
|
|
||||||
message += ` ${greenColor}${descLines[i]}${resetColor}\n`;
|
message += ` ${greenColor}${descLines[i]}${resetColor}\n`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue