@@ -4,6 +4,7 @@ import * as path from 'path';
44import * as os from 'os' ;
55import tokenEstimatorsData from './tokenEstimators.json' ;
66import modelPricingData from './modelPricing.json' ;
7+ import toolNamesData from './toolNames.json' ;
78import { BackendFacade } from './backend/facade' ;
89import { BackendCommandHandler } from './backend/commands' ;
910import * as packageJson from '../package.json' ;
@@ -265,6 +266,9 @@ class CopilotTokenTracker implements vscode.Disposable {
265266 // These are reference prices for cost estimation purposes only
266267 private modelPricing : { [ key : string ] : ModelPricing } = modelPricingData . pricing as { [ key : string ] : ModelPricing } ;
267268
269+ // Tool name mapping - loaded from toolNames.json for friendly display names
270+ private toolNameMap : { [ key : string ] : string } = toolNamesData as { [ key : string ] : string } ;
271+
268272 // Helper method to get repository URL from package.json
269273 private getRepositoryUrl ( ) : string {
270274 const repoUrl = packageJson . repository ?. url ?. replace ( / ^ g i t \+ / , '' ) . replace ( / \. g i t $ / , '' ) ;
@@ -1981,10 +1985,19 @@ class CopilotTokenTracker implements vscode.Disposable {
19811985 /**
19821986 * Extract server name from an MCP tool name.
19831987 * MCP tool names follow the format: mcp.server.tool or mcp_server_tool
1984- * For example: "mcp.io.github.git" → "io", "mcp_io_github_git" → "io"
1985- * Note: Splits on both '.' and '_' to handle various naming conventions
1988+ * For example: "mcp.io.github.git.assign_copilot_to_issue" → "GitHub MCP"
1989+ * Uses the display name from toolNames.json (the part before the colon).
1990+ * Falls back to extracting the second segment if no mapping exists.
19861991 */
19871992 private extractMcpServerName ( toolName : string ) : string {
1993+ // First, try to get the display name from toolNames.json and extract the server part
1994+ const displayName = this . toolNameMap [ toolName ] ;
1995+ if ( displayName && displayName . includes ( ':' ) ) {
1996+ // Extract the part before the colon (e.g., "GitHub MCP" from "GitHub MCP: Issue Read")
1997+ return displayName . split ( ':' ) [ 0 ] . trim ( ) ;
1998+ }
1999+
2000+ // Fallback: extract from tool name structure
19882001 // Remove the mcp. or mcp_ prefix
19892002 const withoutPrefix = toolName . replace ( / ^ m c p [ . _ ] / , '' ) ;
19902003 // Split on . or _ and take the first part (server identifier)
0 commit comments