get_pending_commands
Retrieve commands awaiting approval before execution on macOS to maintain security and control over terminal operations.
Instructions
Get the list of commands pending approval
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:415-436 (handler)The primary MCP tool handler for 'get_pending_commands'. Retrieves pending commands from CommandService and serializes them to JSON in the MCP response format.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)Tool registration entry in the ListToolsRequestSchema handler, specifying name, 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 pending commands returned by the tool.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 extracts and returns the list of pending commands from internal state.public getPendingCommands(): PendingCommand[] { return Array.from(this.pendingCommands.values()); }
- src/index.ts:234-235 (registration)Dispatch case in CallToolRequestSchema handler that routes 'get_pending_commands' calls to the specific handler method.case 'get_pending_commands': return await this.handleGetPendingCommands();