Skip to main content
Glama
StrawHatAI

Claude Desktop Commander MCP

by StrawHatAI

block_command

Prevent specific terminal commands from executing by adding them to a blacklist for controlled command management.

Instructions

Add a command to the blacklist. Once blocked, the command cannot be executed until unblocked.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYes

Implementation Reference

  • Core implementation of the block_command tool. Adds the command to the blockedCommands Set (after normalizing to lowercase), saves to config file, returns true if newly blocked.
    async blockCommand(command: string): Promise<boolean> {
      command = command.toLowerCase().trim();
      if (this.blockedCommands.has(command)) {
        return false;
      }
      this.blockedCommands.add(command);
      await this.saveBlockedCommands();
      return true;
    }
  • MCP server handler for block_command tool call. Parses input args and invokes commandManager.blockCommand.
    case "block_command": {
      const parsed = BlockCommandArgsSchema.parse(args);
      const blockResult = await commandManager.blockCommand(parsed.command);
      return {
        content: [{ type: "text", text: blockResult }],
      };
    }
  • src/server.ts:102-107 (registration)
    Registers the block_command tool in the MCP server's tool list with description and input schema.
    {
      name: "block_command",
      description:
        "Add a command to the blacklist. Once blocked, the command cannot be executed until unblocked.",
      inputSchema: zodToJsonSchema(BlockCommandArgsSchema),
    },
  • Zod schema for validating block_command input: requires a 'command' string.
    export const BlockCommandArgsSchema = z.object({
      command: z.string(),
    });
Behavior2/5

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

With no annotations provided, the description carries the full burden. It discloses the effect ('cannot be executed until unblocked') and mentions persistence ('Once blocked'), but omits critical behavioral details such as permission requirements, whether the change is reversible only via 'unblock_command,' or any rate limits or side effects. This is inadequate for a mutation tool with zero annotation coverage.

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?

The description is two sentences with zero waste: the first states the action and resource, and the second explains the consequence. It is front-loaded and appropriately sized, earning its place efficiently.

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 the complexity of a mutation tool with no annotations, no output schema, and low schema coverage, the description is incomplete. It covers the basic purpose and effect but lacks details on permissions, error handling, return values, or integration with siblings like 'list_blocked_commands,' making it insufficient for safe and effective use.

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?

The input schema has 1 parameter with 0% description coverage, so the description must compensate. It adds meaning by specifying that the parameter is a 'command' to be added to the blacklist, which clarifies the parameter's role beyond the schema's type. However, it doesn't detail the command format, examples, or constraints, leaving gaps in understanding.

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

Purpose4/5

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

The description clearly states the action ('Add a command to the blacklist') and the resource ('command'), making the purpose evident. However, it doesn't explicitly differentiate from its sibling 'unblock_command' beyond the opposite action, missing a direct comparison that would warrant a 5.

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 implies usage by stating 'Once blocked, the command cannot be executed until unblocked,' which suggests when to use it (to prevent command execution). However, it lacks explicit guidance on when to choose this over alternatives like 'edit_block' or 'list_blocked_commands,' and doesn't mention prerequisites or exclusions.

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/StrawHatAI/claude-dev-tools'

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