devcontainer_up
Start or initialize a devcontainer environment in a specified workspace folder to ready it for development tasks.
Instructions
Start or initialize a devcontainer environment in the specified workspace folder.Use this to ensure the devcontainer is running and ready for development tasks.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspaceFolder | Yes | ||
| outputFilePath | No |
Implementation Reference
- src/devcontainer.ts:38-43 (handler)The core handler function for the 'devcontainer_up' tool. It spawns a devcontainer CLI process with the 'up' command and the provided workspace folder.
export async function up(options: DevContainerUpOptions): Promise<number> { return runCommand( ['up', '--workspace-folder', options.workspaceFolder], createStdoutStream(options) ); } - src/devcontainer.ts:15-17 (schema)TypeScript interface defining the options schema for the up function, including the required workspaceFolder field.
interface DevContainerUpOptions extends DevcontainerOptions { workspaceFolder: string; } - src/server.ts:10-30 (registration)Registration of the 'devcontainer_up' tool on the MCP server using server.tool(), defining Zod schema for input and delegating to the handler.
server.tool( "devcontainer_up", "Start or initialize a devcontainer environment in the specified workspace folder." + "Use this to ensure the devcontainer is running and ready for development tasks.", { workspaceFolder: z.string(), outputFilePath: z.string().optional(), }, async ({ workspaceFolder, outputFilePath }) => { await devcontainers.up({ workspaceFolder, stdioFilePath: outputFilePath }); return { content: [ { type: "text", text: `Devcontainer started in ${workspaceFolder}`, } ] } } ); - src/devcontainer.ts:65-83 (helper)Helper function that spawns the devcontainer CLI process and pipes output, used by the up handler.
async function runCommand(args: string[], stdout: fs.WriteStream): Promise<number> { return new Promise((resolve, reject) => { const proc = spawn('node', [devcontainerBinaryPath(), ...args], { stdio: ['ignore', 'pipe', 'inherit'], }); proc.stdout.pipe(stdout); proc.on('close', (code) => { stdout.end(); if (code === 0) { resolve(code); } else { reject(new Error(`devcontainer command ${args.join(' ')} exited with code ${code}`)); } }); }); }