/*---------------------------------------------------------------------------------------------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* Task Tools11*/12export function applyTaskTools(server: McpServer, appService: ApplicationService): RegisteredTool[] {13const tools: RegisteredTool[] = [];1415// Seems too niche16// server.tool(17// 'vscode_automation_task_assert_tasks',18// 'Assert that specific tasks exist with given properties',19// {20// filter: z.string().describe('Filter string for tasks'),21// expected: z.array(z.object({22// label: z.string().optional(),23// type: z.string().optional(),24// command: z.string().optional(),25// identifier: z.string().optional(),26// group: z.string().optional(),27// isBackground: z.boolean().optional(),28// promptOnClose: z.boolean().optional(),29// icon: z.object({30// id: z.string().optional(),31// color: z.string().optional()32// }).optional(),33// hide: z.boolean().optional()34// })).describe('Array of expected task properties'),35// type: z.enum(['run', 'configure']).describe('Type of task operation')36// },37// async (args) => {38// const { filter, expected, type } = args;39// await app.workbench.task.assertTasks(filter, expected, type);40// return {41// content: [{42// type: 'text' as const,43// text: `Asserted ${expected.length} tasks for ${type} with filter: "${filter}"`44// }]45// };46// }47// );4849tools.push(server.tool(50'vscode_automation_task_configure',51'Configure a task with specific properties',52{53properties: z.object({54label: z.string().optional(),55type: z.string().optional(),56command: z.string().optional(),57identifier: z.string().optional(),58group: z.string().optional(),59isBackground: z.boolean().optional(),60promptOnClose: z.boolean().optional(),61icon: z.object({62id: z.string().optional(),63color: z.string().optional()64}).optional(),65hide: z.boolean().optional()66}).describe('Task configuration properties')67},68async (args) => {69const { properties } = args;70const app = await appService.getOrCreateApplication();71await app.workbench.task.configureTask(properties);72return {73content: [{74type: 'text' as const,75text: `Configured task: ${properties.label || properties.identifier || 'unnamed task'}`76}]77};78}79));8081return tools;82}838485