Skip to main content
Glama
MrGNSS

Desktop Commander MCP

block_command

Prevent specific terminal commands from executing by adding them to a blacklist within the Desktop Commander MCP server.

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 handler function that implements the block_command tool logic: normalizes the command, checks if already blocked, adds to internal set if not, persists to config file, and returns boolean success.
    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;
    }
  • Zod schema for input validation of block_command tool, requiring a 'command' string.
    export const BlockCommandArgsSchema = z.object({
      command: z.string(),
    });
  • src/server.ts:103-107 (registration)
    Registers the block_command tool in the MCP server's list of tools, specifying name, 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),
    },
  • MCP server dispatch handler for block_command: parses input args using schema and delegates to commandManager.blockCommand, formats response.
    case "block_command": {
      const parsed = BlockCommandArgsSchema.parse(args);
      const blockResult = await commandManager.blockCommand(parsed.command);
      return {
        content: [{ type: "text", text: blockResult }],
      };
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It clearly indicates a mutation action ('Add to the blacklist') and its effect ('cannot be executed until unblocked'), which covers basic behavioral traits. However, it lacks details on permissions needed, error handling, or system-wide impacts, leaving gaps in transparency for a mutation tool.

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 front-loaded with the core action in the first sentence and adds crucial context in the second. Both sentences earn their place by defining the tool's purpose and effect without redundancy, making it efficient and well-structured for quick understanding.

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

Completeness3/5

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

Given the tool's complexity as a mutation with no annotations and no output schema, the description is minimally complete. It explains what the tool does and the outcome, but lacks details on return values, error cases, or integration with sibling tools like 'list_blocked_commands'. This leaves room for improvement in fully guiding an agent.

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

Parameters4/5

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

The input schema has 0% description coverage, so the description must compensate. It adds meaning by specifying that the 'command' parameter is what gets added to the blacklist, clarifying its role beyond the schema's type definition. However, it does not detail the format or constraints of the command string, such as examples or allowed syntax, which limits full compensation.

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 specific action ('Add a command to the blacklist') and the resource ('command'), distinguishing it from siblings like 'unblock_command' and 'list_blocked_commands'. It explicitly explains the effect ('Once blocked, the command cannot be executed until unblocked'), making the purpose unambiguous.

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 implies usage context by stating the tool blocks commands from execution, which suggests it should be used for security or control purposes. However, it does not explicitly mention when to use it versus alternatives like 'edit_block' or 'unblock_command', nor does it provide exclusions or prerequisites, leaving some ambiguity in sibling differentiation.

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/MrGNSS/ClaudeDesktopCommander'

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