Skip to content

Commit 12c0f38

Browse files
Copilotrajbos
andcommitted
Improve documentation for extractMcpServerName method
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
1 parent 120a779 commit 12c0f38

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/extension.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1859,11 +1859,13 @@ class CopilotTokenTracker implements vscode.Disposable {
18591859
/**
18601860
* Extract server name from an MCP tool name.
18611861
* MCP tool names follow the format: mcp.server.tool or mcp_server_tool
1862+
* For example: "mcp.io.github.git" → "io", "mcp_io_github_git" → "io"
1863+
* Note: Splits on both '.' and '_' to handle various naming conventions
18621864
*/
18631865
private extractMcpServerName(toolName: string): string {
18641866
// Remove the mcp. or mcp_ prefix
18651867
const withoutPrefix = toolName.replace(/^mcp[._]/, '');
1866-
// Split on . or _ and take the first part
1868+
// Split on . or _ and take the first part (server identifier)
18671869
const parts = withoutPrefix.split(/[._]/);
18681870
// Return the first non-empty part, or 'unknown' if none exist
18691871
return parts[0] || 'unknown';

0 commit comments

Comments
 (0)