mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 01:07:46 +00:00
Sync upstream Gemini-CLI v0.8.2 (#838)
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
||||
type SlashCommand,
|
||||
CommandKind,
|
||||
} from './types.js';
|
||||
import { MessageType } from '../types.js';
|
||||
import { MessageType, type HistoryItemToolsList } from '../types.js';
|
||||
|
||||
export const toolsCommand: SlashCommand = {
|
||||
name: 'tools',
|
||||
@@ -40,32 +40,16 @@ export const toolsCommand: SlashCommand = {
|
||||
// Filter out MCP tools by checking for the absence of a serverName property
|
||||
const geminiTools = tools.filter((tool) => !('serverName' in tool));
|
||||
|
||||
let message = 'Available Qwen Code tools:\n\n';
|
||||
const toolsListItem: HistoryItemToolsList = {
|
||||
type: MessageType.TOOLS_LIST,
|
||||
tools: geminiTools.map((tool) => ({
|
||||
name: tool.name,
|
||||
displayName: tool.displayName,
|
||||
description: tool.description,
|
||||
})),
|
||||
showDescriptions: useShowDescriptions,
|
||||
};
|
||||
|
||||
if (geminiTools.length > 0) {
|
||||
geminiTools.forEach((tool) => {
|
||||
if (useShowDescriptions && tool.description) {
|
||||
message += ` - \u001b[36m${tool.displayName} (${tool.name})\u001b[0m:\n`;
|
||||
|
||||
const greenColor = '\u001b[32m';
|
||||
const resetColor = '\u001b[0m';
|
||||
|
||||
// Handle multi-line descriptions
|
||||
const descLines = tool.description.trim().split('\n');
|
||||
for (const descLine of descLines) {
|
||||
message += ` ${greenColor}${descLine}${resetColor}\n`;
|
||||
}
|
||||
} else {
|
||||
message += ` - \u001b[36m${tool.displayName}\u001b[0m\n`;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
message += ' No tools available\n';
|
||||
}
|
||||
message += '\n';
|
||||
|
||||
message += '\u001b[0m';
|
||||
|
||||
context.ui.addItem({ type: MessageType.INFO, text: message }, Date.now());
|
||||
context.ui.addItem(toolsListItem, Date.now());
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user