Skip to main content
Glama

devcontainer_run_user_commands

Execute user-defined postCreateCommand and postStartCommand scripts in a devcontainer for a given workspace folder to automate setup or initialization after container start.

Instructions

Run the user-defined postCreateCommand and postStartCommand scripts in the devcontainerfor the specified workspace folder. Use this to execute setup or initialization commandsafter the devcontainer starts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceFolderYes
outputFilePathNo

Implementation Reference

  • src/server.ts:32-53 (registration)
    MCP server registration for tool 'devcontainer_run_user_commands' using server.tool() with Zod schema and async handler.
    server.tool(
      "devcontainer_run_user_commands",
      "Run the user-defined postCreateCommand and postStartCommand scripts in the devcontainer" +
      "for the specified workspace folder. Use this to execute setup or initialization commands" + 
      "after the devcontainer starts.",
      {
        workspaceFolder: z.string(),
        outputFilePath: z.string().optional(),
      },
      async ({ workspaceFolder, outputFilePath }) => {
        await devcontainers.runUserCommands({ workspaceFolder, stdioFilePath: outputFilePath });
    
        return {
          content: [
            {
              type: "text",
              text: `User commands run in ${workspaceFolder}`,
            }
          ]
        }
      }
    );
  • TypeScript interface DevContainerRunUserCommandsOptions defining input schema (workspaceFolder, optional stdioFilePath).
    interface DevContainerRunUserCommandsOptions extends DevcontainerOptions {
      workspaceFolder: string;
    }
  • Core handler function runUserCommands() that calls runCommand with 'run-user-commands' subcommand and workspace folder.
    export async function runUserCommands(options: DevContainerRunUserCommandsOptions): Promise<number> {
      return runCommand(
        ['run-user-commands', '--workspace-folder', options.workspaceFolder],
        createStdoutStream(options)
      );
    }
  • src/server.ts:41-52 (registration)
    Inline async handler in server.tool() registration that delegates to devcontainers.runUserCommands() and returns success message.
    async ({ workspaceFolder, outputFilePath }) => {
      await devcontainers.runUserCommands({ workspaceFolder, stdioFilePath: outputFilePath });
    
      return {
        content: [
          {
            type: "text",
            text: `User commands run in ${workspaceFolder}`,
          }
        ]
      }
    }
  • Helper runCommand() that spawns the devcontainer CLI process with provided args and pipes stdout.
    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}`));
          }
        });
      });
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description should fully disclose behavioral traits. It mentions execution of scripts but does not clarify side effects, permissions, or whether scripts run synchronously, leaving significant gaps for an agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences front-load the action and purpose, with no redundant text, though minor clarity improvements are possible.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and no annotations, the description lacks crucial behavior like success/failure results, error handling, and execution mode, making it incomplete for safe agent invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%; the description only alludes to workspaceFolder but fails to explain outputFilePath, leaving both parameters largely underdefined despite the tool's execution role.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it runs 'postCreateCommand and postStartCommand scripts' for a specific workspace folder, using strong verbs and resource specification that distinguishes it from siblings like devcontainer_exec and devcontainer_up.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description advises using this tool 'to execute setup or initialization commands after the devcontainer starts,' providing clear context, but does not explicitly exclude uses or compare to alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/crunchloop/mcp-devcontainers'

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