Skip to main content
Glama

devcontainer_exec

Execute arbitrary shell commands within a devcontainer context for a given workspace folder.

Instructions

Execute an arbitrary shell command inside the devcontainer for the specified workspace folder.Use this to run custom commands or scripts within the devcontainer context.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceFolderYes
commandYes
outputFilePathNo

Implementation Reference

  • src/server.ts:55-75 (registration)
    Registration of the devcontainer_exec MCP tool via server.tool(), defining input schema and the handler callback.
    server.tool(
      "devcontainer_exec",
      "Execute an arbitrary shell command inside the devcontainer for the specified workspace folder." +
      "Use this to run custom commands or scripts within the devcontainer context.",
      {
        workspaceFolder: z.string(),
        command: z.array(z.string()),
        outputFilePath: z.string().optional(),
      },
      async ({ workspaceFolder, command, outputFilePath }) => {
        await devcontainers.exec({ workspaceFolder, command, stdioFilePath: outputFilePath });
        return {
          content: [
            {
              type: "text",
              text: `Executed command ${command.join(" ")} in ${workspaceFolder}`,
            }
          ]
        }
      }
    );
  • Zod schema for the devcontainer_exec tool: workspaceFolder (string), command (array of strings), and optional outputFilePath (string).
    {
      workspaceFolder: z.string(),
      command: z.array(z.string()),
      outputFilePath: z.string().optional(),
  • Core handler that executes a command inside the devcontainer by spawning the devcontainer CLI with 'exec' subcommand.
    export async function exec(options: DevContainerExecOptions): Promise<number> {
      return runCommand(
        ['exec', '--workspace-folder', options.workspaceFolder, ...options.command],
        createStdoutStream(options)
      );
    }
  • TypeScript interface defining the options for the exec function: workspaceFolder and command array.
    interface DevContainerExecOptions extends DevcontainerOptions {
      workspaceFolder: string;
      command: string[];
    }
  • Helper function that spawns the devcontainer CLI process, pipes stdout to a stream, and resolves/rejects based on the 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}`));
          }
        });
      });
    }
Behavior2/5

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

No annotations are provided, so the description carries the burden. It mentions execution inside a specific devcontainer but does not disclose whether the call blocks, how output is returned (though schema has optional outputFilePath), timeout behavior, or error handling. Essential behavioral traits are missing.

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

Conciseness3/5

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

The description consists of two sentences, the second of which largely repeats the first ('Use this to run custom commands or scripts'). It could be more concise by merging the second into the first or removing redundancy. Overall short but not optimally efficient.

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?

The description is minimal given the tool's complexity (3 params, no output schema, no annotations). It does not explain return values, prerequisites (e.g., devcontainer must be up), or error handling. The optional outputFilePath parameter is left unexplained, leaving the agent without enough context to use the tool effectively.

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

Parameters1/5

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

Schema description coverage is 0%, meaning no parameter descriptions in schema. The tool description does not add any meaning beyond parameter names: workspaceFolder, command (array of strings), and outputFilePath (optional). It fails to explain the format of command array, what outputFilePath does, or expected values.

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 the verb 'Execute' and the resource 'arbitrary shell command inside the devcontainer for the specified workspace folder'. It distinguishes from siblings: devcontainer_run_user_commands runs predefined commands, devcontainer_up sets up the container.

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

Usage Guidelines3/5

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

The description says 'Use this to run custom commands or scripts', which gives a general usage context but does not explicitly state when not to use or provide alternatives. It implies custom commands versus predefined ones from siblings but lacks clear exclusion criteria.

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