Skip to main content
Glama
cfdude

Mac Shell MCP Server

update_security_level

Modify the security classification of approved macOS terminal commands to control execution permissions and access restrictions.

Instructions

Update the security level of a whitelisted command

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYesThe command to update
securityLevelYesNew security level for the command

Implementation Reference

  • Primary MCP tool handler: validates input with Zod schema, maps security level string to enum, delegates to CommandService.updateSecurityLevel, returns confirmation message.
    private async handleUpdateSecurityLevel(args: unknown) {
      const schema = z.object({
        command: z.string(),
        securityLevel: z.enum(['safe', 'requires_approval', 'forbidden']),
      });
    
      const { command, securityLevel } = schema.parse(args);
    
      // Map string security level to enum
      const securityLevelEnum =
        securityLevel === 'safe'
          ? CommandSecurityLevel.SAFE
          : securityLevel === 'requires_approval'
            ? CommandSecurityLevel.REQUIRES_APPROVAL
            : CommandSecurityLevel.FORBIDDEN;
    
      this.commandService.updateSecurityLevel(command, securityLevelEnum);
    
      return {
        content: [
          {
            type: 'text',
            text: `Security level for command '${command}' updated to '${securityLevel}'`,
          },
        ],
      };
    }
  • Core logic implementation: retrieves the whitelist entry for the command, updates its securityLevel, and stores it back in the whitelist Map.
    public updateSecurityLevel(command: string, securityLevel: CommandSecurityLevel): void {
      const entry = this.whitelist.get(command);
      if (entry) {
        entry.securityLevel = securityLevel;
        this.whitelist.set(command, entry);
      }
    }
  • src/index.ts:142-160 (registration)
    Tool registration in the ListTools response: defines name, description, and input schema for MCP protocol compliance.
    {
      name: 'update_security_level',
      description: 'Update the security level of a whitelisted command',
      inputSchema: {
        type: 'object',
        properties: {
          command: {
            type: 'string',
            description: 'The command to update',
          },
          securityLevel: {
            type: 'string',
            enum: ['safe', 'requires_approval', 'forbidden'],
            description: 'New security level for the command',
          },
        },
        required: ['command', 'securityLevel'],
      },
    },
  • Zod schema used in handler for runtime input validation, matching the declared inputSchema.
    const schema = z.object({
      command: z.string(),
      securityLevel: z.enum(['safe', 'requires_approval', 'forbidden']),
    });
  • Type definition enum for CommandSecurityLevel used throughout the implementation.
    export enum CommandSecurityLevel {
      /** Safe commands that can be executed without approval */
      SAFE = 'safe',
      /** Commands that require approval before execution */
      REQUIRES_APPROVAL = 'requires_approval',
      /** Commands that are explicitly forbidden */
      FORBIDDEN = 'forbidden',
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Update' implies a mutation, it doesn't specify required permissions, whether changes are reversible, error conditions (e.g., if command isn't whitelisted), or side effects. This leaves significant gaps for a security-related 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 a single, direct sentence with zero wasted words. It front-loads the core action and target efficiently, making it easy to parse while conveying essential purpose.

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?

For a mutation tool with no annotations and no output schema, the description is insufficient. It lacks critical context: what 'security level' means operationally, how changes affect command execution, error handling, or response format. Given the security-sensitive nature and sibling tools, more completeness is needed.

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?

Schema description coverage is 100%, so parameters are fully documented in the schema. The description adds no additional parameter context beyond implying 'command' refers to a whitelisted one. This meets the baseline for high schema coverage but doesn't enhance understanding of parameter usage or constraints.

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 ('Update') and the target ('security level of a whitelisted command'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from siblings like 'add_to_whitelist' or 'remove_from_whitelist', which also modify command permissions but in different ways.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., the command must already be whitelisted), contrast with 'approve_command'/'deny_command' for pending requests, or explain when changing security levels is appropriate versus adding/removing from the whitelist.

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/cfdude/mac-shell-mcp'

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