Skip to main content
Glama
capsulerun

Capsule Bash Server

Official

reset

Restore the sandboxed filesystem, environment variables, and current working directory to their initial values for a specified session.

Instructions

Reset the sandboxed filesystem and shell state (cwd, env vars) for a session back to their initial values.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idNoThe session to reset. Defaults to 'default'.default

Implementation Reference

  • The MCP tool handler for 'reset'. Calls bash.reset() and returns a JSON response with ok: true.
    async ({ session_id }) => {
      const bash = getSession(session_id ?? 'default');
    
      bash.reset();
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({ ok: true, session_id: session_id ?? 'default' }),
          },
        ],
      };
    },
  • The schema/registration metadata for the 'reset' tool, describing its input (optional session_id).
    {
      description:
        'Reset the sandboxed filesystem and shell state (cwd, env vars) for a session back to their initial values.',
      inputSchema: {
        session_id: z
          .string()
          .optional()
          .default('default')
          .describe("The session to reset. Defaults to 'default'."),
      },
  • Registration of the 'reset' tool via server.registerTool().
    server.registerTool(
      'reset',
      {
        description:
          'Reset the sandboxed filesystem and shell state (cwd, env vars) for a session back to their initial values.',
        inputSchema: {
          session_id: z
            .string()
            .optional()
            .default('default')
            .describe("The session to reset. Defaults to 'default'."),
        },
      },
      async ({ session_id }) => {
        const bash = getSession(session_id ?? 'default');
    
        bash.reset();
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ ok: true, session_id: session_id ?? 'default' }),
            },
          ],
        };
      },
    );
  • Bash class reset() method - delegates to both filesystem.reset() and stateManager.reset().
    reset() {
      this.filesystem.reset();
      this.stateManager.reset();
    }
  • Filesystem.reset() - wipes the sandbox directory and re-initializes it (deletes all files, recreates directory structure and default files).
    reset() {
      fs.rmSync(this.workspace, { recursive: true, force: true });
      this.init();
    }
  • StateManager.reset() - resets cwd to '/workspace', clears env, and sets lastExitCode to 0.
    public reset() {
      this.state.cwd = '/workspace';
      this.state.env = {};
      this.state.lastExitCode = 0;
    }
Behavior4/5

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

Discloses what is reset (filesystem, cwd, env vars) and that it restores 'initial values'. With no annotations, this is sufficient, though it could explicitly mention that data is lost or that it is destructive.

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

Conciseness5/5

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

Single, well-structured sentence that front-loads the action and specifies scope. No unnecessary words.

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

Completeness4/5

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

Adequately covers the tool's purpose and parameter for its simplicity. Could mention if session must exist, but overall complete.

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

Parameters3/5

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

Only one parameter with full schema coverage; description adds no extra meaning beyond schema's 'session_id' description. Baseline score applies.

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?

Clearly states the tool resets sandboxed filesystem and shell state (cwd, env vars) to initial values. Specific verb and resource, well-distinguished from siblings 'run' and 'sessions'.

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?

Usage context is clear: reset a session to initial state. However, no explicit guidance on when to use vs alternatives (e.g., using 'sessions' to manage sessions) or prerequisites.

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/capsulerun/bash'

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