Add another server built on top of our own automation framework (#262984)

* Add another server built on top of our own automation framework

It's a big PR but a lot of this is boiler plate. It's just essentially wrapping our Automation framework in a bunch of tools.

* Lay the foundation for multiplexing
This commit is contained in:
Tyler James Leonhardt
2025-08-22 17:20:22 -07:00
committed by GitHub
parent 7db6be89a1
commit a7cdeedd57
27 changed files with 3033 additions and 519 deletions

View File

@@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { Application } from '../../../automation';
import { z } from 'zod';
/**
* Task Tools
*/
export function applyTaskTools(server: McpServer, app: Application) {
server.tool(
'vscode_automation_task_assert_tasks',
'Assert that specific tasks exist with given properties',
{
filter: z.string().describe('Filter string for tasks'),
expected: z.array(z.object({
label: z.string().optional(),
type: z.string().optional(),
command: z.string().optional(),
identifier: z.string().optional(),
group: z.string().optional(),
isBackground: z.boolean().optional(),
promptOnClose: z.boolean().optional(),
icon: z.object({
id: z.string().optional(),
color: z.string().optional()
}).optional(),
hide: z.boolean().optional()
})).describe('Array of expected task properties'),
type: z.enum(['run', 'configure']).describe('Type of task operation')
},
async (args) => {
const { filter, expected, type } = args;
await app.workbench.task.assertTasks(filter, expected, type);
return {
content: [{
type: 'text' as const,
text: `Asserted ${expected.length} tasks for ${type} with filter: "${filter}"`
}]
};
}
);
server.tool(
'vscode_automation_task_configure',
'Configure a task with specific properties',
{
properties: z.object({
label: z.string().optional(),
type: z.string().optional(),
command: z.string().optional(),
identifier: z.string().optional(),
group: z.string().optional(),
isBackground: z.boolean().optional(),
promptOnClose: z.boolean().optional(),
icon: z.object({
id: z.string().optional(),
color: z.string().optional()
}).optional(),
hide: z.boolean().optional()
}).describe('Task configuration properties')
},
async (args) => {
const { properties } = args;
await app.workbench.task.configureTask(properties);
return {
content: [{
type: 'text' as const,
text: `Configured task: ${properties.label || properties.identifier || 'unnamed task'}`
}]
};
}
);
}