/*---------------------------------------------------------------------------------------------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 { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';6import { ApplicationService } from '../application';7import { z } from 'zod';89/**10* Source Control Management Tools11*/12export function applySCMTools(server: McpServer, appService: ApplicationService): RegisteredTool[] {13const tools: RegisteredTool[] = [];1415// Playwright can probably figure this one out16// server.tool(17// 'vscode_automation_scm_open',18// 'Open the Source Control Management viewlet',19// async () => {20// await app.workbench.scm.openSCMViewlet();21// return {22// content: [{23// type: 'text' as const,24// text: 'Opened SCM viewlet'25// }]26// };27// }28// );2930// Playwright can probably figure this one out31// server.tool(32// 'vscode_automation_scm_wait_for_change',33// 'Wait for a specific change to appear in SCM',34// {35// name: z.string().describe('Name of the file change to wait for'),36// type: z.string().optional().describe('Type of change (optional)')37// },38// async (args) => {39// const { name, type } = args;40// await app.workbench.scm.waitForChange(name, type);41// return {42// content: [{43// type: 'text' as const,44// text: `Change detected: ${name}${type ? ` (${type})` : ''}`45// }]46// };47// }48// );4950// Playwright can probably figure this one out51// server.tool(52// 'vscode_automation_scm_refresh',53// 'Refresh the SCM viewlet',54// async () => {55// await app.workbench.scm.refreshSCMViewlet();56// return {57// content: [{58// type: 'text' as const,59// text: 'Refreshed SCM viewlet'60// }]61// };62// }63// );6465// Playwright can probably figure this one out66// server.tool(67// 'vscode_automation_scm_open_change',68// 'Open a specific change in the SCM viewlet',69// {70// name: z.string().describe('Name of the file change to open')71// },72// async (args) => {73// const { name } = args;74// await app.workbench.scm.openChange(name);75// return {76// content: [{77// type: 'text' as const,78// text: `Opened change: ${name}`79// }]80// };81// }82// );8384// Playwright can probably figure this one out85// server.tool(86// 'vscode_automation_scm_stage',87// 'Stage a specific file change',88// {89// name: z.string().describe('Name of the file to stage')90// },91// async (args) => {92// const { name } = args;93// await app.workbench.scm.stage(name);94// return {95// content: [{96// type: 'text' as const,97// text: `Staged file: ${name}`98// }]99// };100// }101// );102103// Playwright can probably figure this one out104// server.tool(105// 'vscode_automation_scm_unstage',106// 'Unstage a specific file change',107// {108// name: z.string().describe('Name of the file to unstage')109// },110// async (args) => {111// const { name } = args;112// await app.workbench.scm.unstage(name);113// return {114// content: [{115// type: 'text' as const,116// text: `Unstaged file: ${name}`117// }]118// };119// }120// );121122tools.push(server.tool(123'vscode_automation_scm_commit',124'Commit staged changes with a message',125{126message: z.string().describe('Commit message')127},128async (args) => {129const { message } = args;130const app = await appService.getOrCreateApplication();131await app.workbench.scm.commit(message);132return {133content: [{134type: 'text' as const,135text: `Committed changes with message: "${message}"`136}]137};138}139));140141return tools;142}143144145