Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
projectNameYes
languageYes
buildCommandNo
testCommandNo

Implementation Reference

  • 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 }] };
    }
  • 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 }],

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/millsydotdev/Code-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server