generate_vscode_tasks
Create VSCode tasks.json files to automate build and test commands for your development projects.
Instructions
Generates a .vscode/tasks.json file for VSCode.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectName | Yes | ||
| language | Yes | ||
| buildCommand | No | ||
| testCommand | No |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"buildCommand": {
"type": "string"
},
"language": {
"type": "string"
},
"projectName": {
"type": "string"
},
"testCommand": {
"type": "string"
}
},
"required": [
"projectName",
"language"
],
"type": "object"
}
Implementation Reference
- src/tools/ideconfigs.ts:84-113 (handler)The core handler function that implements the generate_vscode_tasks tool logic, generating a VSCode tasks.json file based on project name, language, and optional commands.export function generateVSCodeTasksHandler(args: any) { const { projectName, language, buildCommand, testCommand } = args; const defaultBuild = language === "typescript" ? "npm run build" : language === "python" ? "python -m pytest" : language === "rust" ? "cargo build" : "npm run build"; const defaultTest = language === "typescript" ? "npm test" : language === "python" ? "python -m pytest" : language === "rust" ? "cargo test" : "npm test"; const content = JSON.stringify({ "version": "2.0.0", "tasks": [ { "label": "Build", "type": "shell", "command": buildCommand || defaultBuild, "group": { "kind": "build", "isDefault": true }, "problemMatcher": ["$tsc"] }, { "label": "Test", "type": "shell", "command": testCommand || defaultTest, "group": { "kind": "test", "isDefault": true } } ] }, null, 2); return { content: [{ type: "text", text: content }] }; }
- src/tools/ideconfigs.ts:73-82 (schema)The input schema definition using Zod for validating arguments to the generate_vscode_tasks tool.export const generateVSCodeTasksSchema = { name: "generate_vscode_tasks", description: "Generates a .vscode/tasks.json file for VSCode.", inputSchema: z.object({ projectName: z.string(), language: z.string(), buildCommand: z.string().optional(), testCommand: z.string().optional() }) };
- src/server.ts:115-115 (registration)Registration of the generate_vscode_tasks tool in the HTTP server's tool registry map.["generate_vscode_tasks", { schema: generateVSCodeTasksSchema, handler: generateVSCodeTasksHandler }],
- src/index.ts:109-109 (registration)Registration of the generate_vscode_tasks tool in the main MCP server's tool registry map.["generate_vscode_tasks", { schema: generateVSCodeTasksSchema, handler: generateVSCodeTasksHandler }],