devcontainer_up
Initialize and start a devcontainer environment in a specified workspace folder to prepare for development tasks. Ensures the container is running and ready.
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
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| outputFilePath | No | ||
| workspaceFolder | Yes |
Implementation Reference
- src/devcontainer.ts:38-43 (handler)Core handler function that runs the devcontainer 'up' command by calling the internal runCommand helper with appropriate arguments.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 input parameters for the devcontainer up handler.interface DevContainerUpOptions extends DevcontainerOptions { workspaceFolder: string; }
- src/server.ts:10-30 (registration)MCP tool registration for 'devcontainer_up', including tool description, Zod input schema validation, and thin wrapper handler that calls the core up implementation.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)Internal helper that spawns the Node.js process for the devcontainer CLI binary, pipes stdout, and resolves/rejects based on exit code.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}`)); } }); }); }
- src/devcontainer.ts:85-90 (helper)Helper function to create a write stream for stdout, either to a file or /dev/null.function createStdoutStream(options: DevcontainerOptions): fs.WriteStream { if (!options.stdioFilePath) return fs.createWriteStream('/dev/null', { flags: 'w' }) return fs.createWriteStream(options.stdioFilePath, { flags: 'w' }); }