Skip to content

Commit 51c39fb

Browse files
authored
Merge pull request #623 from rajbos/rajbos/fix-case-insensitive-tool-name-lookup
Fix case-insensitive tool name lookup and remove duplicate entries
2 parents 08d26c7 + 9f12ed8 commit 51c39fb

File tree

7 files changed

+9
-14
lines changed

7 files changed

+9
-14
lines changed

vscode-extension/src/automaticTools.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"read_file",
33
"copilot_readFile",
44
"read",
5-
"Read",
65
"view",
76
"view_image",
87
"copilot_viewImage",
@@ -95,7 +94,6 @@
9594
"copilot_switchAgent",
9695

9796
"bash",
98-
"Bash",
9997

10098
"vscode_editFile_internal",
10199
"vscode_fetchWebPage_internal",

vscode-extension/src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ class CopilotTokenTracker implements vscode.Disposable {
10211021
Object.keys(stats.today.toolCalls.byTool).forEach(tool => allTools.add(tool));
10221022
Object.keys(stats.last30Days.toolCalls.byTool).forEach(tool => allTools.add(tool));
10231023
Object.keys(stats.month.toolCalls.byTool).forEach(tool => allTools.add(tool));
1024-
return Array.from(allTools).filter(tool => !this.toolNameMap[tool]).sort();
1024+
return Array.from(allTools).filter(tool => !this.toolNameMap[tool] && !this.toolNameMap[tool.toLowerCase()]).sort();
10251025
}
10261026

10271027
private async showUnknownMcpToolsBanner(): Promise<void> {

vscode-extension/src/maturityScoring.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import automaticToolIds from './automaticTools.json';
1212

1313
/** Set of tool IDs that Copilot uses autonomously (reading files, searching, etc.).
1414
* These are excluded from fluency scoring since the user doesn't configure them. */
15-
const AUTOMATIC_TOOL_SET = new Set<string>(automaticToolIds);
15+
const AUTOMATIC_TOOL_SET = new Set<string>((automaticToolIds as string[]).map(id => id.toLowerCase()));
1616

1717
/** Format a number with thousand separators for display. */
1818
function fmt(n: number): string {
@@ -445,7 +445,7 @@ export function calculateFluencyScoreForTeamMember(fd: {
445445
const hasModelSwitching = fd.mixedTierSessions > 0 || switchingFrequency > 0;
446446
const hasAgentMode = fd.agentModeCount > 0;
447447
const toolCount = Object.keys(fd.toolCallsByTool).length;
448-
const nonAutoToolCount = Object.keys(fd.toolCallsByTool).filter(t => !AUTOMATIC_TOOL_SET.has(t)).length;
448+
const nonAutoToolCount = Object.keys(fd.toolCallsByTool).filter(t => !AUTOMATIC_TOOL_SET.has(t.toLowerCase())).length;
449449
const avgFilesPerSession = fd.filesPerEditCount > 0 ? fd.filesPerEditSum / fd.filesPerEditCount : 0;
450450
const avgApplyRate = fd.applyRateCount > 0 ? fd.applyRateSum / fd.applyRateCount : 0;
451451
const totalContextRefs = fd.ctxFile + fd.ctxSelection + fd.ctxSymbol + fd.ctxCodebase + fd.ctxWorkspace;
@@ -861,7 +861,7 @@ export async function calculateMaturityScores(lastCustomizationMatrix: Workspace
861861

862862
// Diverse tool usage in agent mode
863863
const toolCount = Object.keys(p.toolCalls.byTool).length;
864-
const nonAutoToolCount = Object.keys(p.toolCalls.byTool).filter(t => !AUTOMATIC_TOOL_SET.has(t)).length;
864+
const nonAutoToolCount = Object.keys(p.toolCalls.byTool).filter(t => !AUTOMATIC_TOOL_SET.has(t.toLowerCase())).length;
865865
if (p.modeUsage.agent >= 10 && nonAutoToolCount >= 3) {
866866
agStage = 3;
867867
}

vscode-extension/src/toolNames.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@
314314
,"grep": "Grep"
315315
,"kill_terminal": "Kill Terminal"
316316
,"read": "Read"
317-
,"Read": "Read"
318317
,"view": "View"
319318
,"vscode_editFile_internal": "VSCode Edit File (Internal)"
320319
,"vscode_fetchWebPage_internal": "VSCode Fetch Web Page (Internal)"
@@ -327,9 +326,7 @@
327326
,"nuget_get-nuget-solver": "NuGet: Get NuGet Solver"
328327
,"webfetch": "Web Fetch"
329328
,"write": "Write"
330-
,"Write": "Write"
331329
,"edit": "Edit"
332-
,"Edit": "Edit"
333330
,"multiedit": "Multi Edit"
334331
,"question": "Question"
335332
,"skill": "Skill"

vscode-extension/src/webview/logviewer/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function lookupToolName(id: string): string {
8686
if (!TOOL_NAME_MAP) {
8787
return id;
8888
}
89-
return TOOL_NAME_MAP[id] || id;
89+
return TOOL_NAME_MAP[id] ?? TOOL_NAME_MAP[id.toLowerCase()] ?? id;
9090
}
9191

9292
function escapeHtml(text: string): string {

vscode-extension/src/webview/usage/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,13 @@ import toolNames from '../../toolNames.json';
172172
import automaticToolIds from '../../automaticTools.json';
173173

174174
let TOOL_NAME_MAP: { [key: string]: string } | null = toolNames || null;
175-
const AUTOMATIC_TOOL_SET_WV = new Set<string>(automaticToolIds as string[]);
175+
const AUTOMATIC_TOOL_SET_WV = new Set<string>((automaticToolIds as string[]).map(id => id.toLowerCase()));
176176

177177
function lookupToolName(id: string): string {
178178
if (!TOOL_NAME_MAP) {
179179
return id;
180180
}
181-
return TOOL_NAME_MAP[id] || id;
181+
return TOOL_NAME_MAP[id] ?? TOOL_NAME_MAP[id.toLowerCase()] ?? id;
182182
}
183183

184184
function lookupMcpToolName(id: string): string {
@@ -304,7 +304,7 @@ function renderToolsTable(byTool: { [key: string]: number }, limit = 10, nameRes
304304
const rows = sortedTools.map(([tool, count], idx) => {
305305
const friendly = escapeHtml(nameResolver(tool));
306306
const idEscaped = escapeHtml(tool);
307-
const autoBadge = AUTOMATIC_TOOL_SET_WV.has(tool)
307+
const autoBadge = AUTOMATIC_TOOL_SET_WV.has(tool.toLowerCase())
308308
? `<span class="auto-badge" title="Automatic tool — Copilot uses this internally and it does not count toward fluency scoring">auto</span>`
309309
: '';
310310
return `

vscode-extension/src/workspaceHelpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ export function normalizeMcpToolName(toolName: string): string {
481481
*/
482482
export function extractMcpServerName(toolName: string, toolNameMap: { [key: string]: string } = {}): string {
483483
// First, try to get the display name from toolNames.json and extract the server part
484-
const displayName = toolNameMap[toolName];
484+
const displayName = toolNameMap[toolName] ?? toolNameMap[toolName.toLowerCase()];
485485
if (displayName && displayName.includes(':')) {
486486
// Extract the part before the colon (e.g., "GitHub MCP" from "GitHub MCP: Issue Read")
487487
return displayName.split(':')[0].trim();

0 commit comments

Comments
 (0)