Skip to main content
Glama

get_pending_commands

Retrieve a list of macOS terminal commands awaiting approval for secure execution through the Mac Shell MCP Server, ensuring controlled and authorized command processing.

Instructions

Get the list of commands pending approval

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "type": "object" }

Implementation Reference

  • The MCP tool handler for 'get_pending_commands'. Fetches pending commands from CommandService, maps them to a client-friendly format, and returns as JSON-formatted text content.
    private async handleGetPendingCommands() { const pendingCommands = this.commandService.getPendingCommands(); return { content: [ { type: 'text', text: JSON.stringify( pendingCommands.map((cmd) => ({ id: cmd.id, command: cmd.command, args: cmd.args, requestedAt: cmd.requestedAt, requestedBy: cmd.requestedBy, })), null, 2, ), }, ], }; }
  • src/index.ts:175-182 (registration)
    Registration of the 'get_pending_commands' tool in the MCP listTools handler, including its description and empty input schema.
    { name: 'get_pending_commands', description: 'Get the list of commands pending approval', inputSchema: { type: 'object', properties: {}, }, },
  • TypeScript interface defining the structure of a PendingCommand, which is the data type returned by getPendingCommands.
    export interface PendingCommand { /** Unique ID for the command */ id: string; /** The command to execute */ command: string; /** Arguments for the command */ args: string[]; /** When the command was requested */ requestedAt: Date; /** Who requested the command */ requestedBy?: string; /** Resolve function to call when approved */ resolve: (value: { stdout: string; stderr: string }) => void; /** Reject function to call when denied */ reject: (reason: Error) => void; }
  • Helper method in CommandService that retrieves all pending commands from the internal Map.
    public getPendingCommands(): PendingCommand[] { return Array.from(this.pendingCommands.values()); }

Other Tools

Related 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