get_pending_commands
Retrieve commands awaiting approval for secure execution across Windows, macOS, and Linux systems.
Instructions
Get the list of commands pending approval
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:553-573 (handler)The primary handler for the 'get_pending_commands' tool. It fetches pending commands from the CommandService and formats them as JSON text content for the MCP response./** * Handle get_pending_commands tool */ 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:234-241 (registration)Registration of the 'get_pending_commands' tool in the list of available tools, including its name, description, and empty input schema.{ name: 'get_pending_commands', description: 'Get the list of commands pending approval', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:295-296 (handler)Dispatch in the tool call switch statement that routes 'get_pending_commands' calls to the handler function.case 'get_pending_commands': return await this.handleGetPendingCommands();
- Helper method in CommandService that retrieves and returns all pending commands from the internal queue.public getPendingCommands(): PendingCommand[] { return Array.from(this.pendingCommands.values()); }
- TypeScript interface defining the structure of PendingCommand objects 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; }