Path: blob/main/extensions/copilot/src/extension/chatSessions/copilotcli/vscode-node/tools/updateSessionName.ts
13406 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';6import { z } from 'zod';7import { ILogger } from '../../../../../platform/log/common/logService';8import { ICopilotCLISessionTracker } from '../copilotCLISessionTracker';9import { makeTextResult } from './utils';1011export function registerUpdateSessionNameTool(server: McpServer, logger: ILogger, sessionTracker: ICopilotCLISessionTracker, sessionId: string): void {12const schema = {13name: z.string().describe('The new session name'),14};15server.registerTool(16'update_session_name',17{18description: 'Update the display name for the current CLI session',19inputSchema: schema,20},21// @ts-ignore - TS2589: zod type instantiation too deep for server.tool() generics22async (args: { name: string }) => {23const { name } = args;24logger.debug(`Updating session name for ${sessionId} to "${name}"`);25sessionTracker.setSessionName(sessionId, name);26return makeTextResult({ success: true });27}28);29}303132