ssh_history
View and filter executed operations from the active SSH connection to monitor command history and track reversible actions.
Instructions
Muestra el historial de operaciones ejecutadas durante la conexión activa. Permite filtrar por tipo de operación y limitar resultados
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | Filtro del historial: 'all' (todas), 'reversible' (solo reversibles), 'reversed' (solo revertidas). Default: 'all' | |
| limit | No | Número máximo de registros a retornar (default: 20) |
Implementation Reference
- src/index.ts:761-802 (handler)Implementation of the ssh_history tool handler.
private handleHistory(args: any): CallToolResult { this.requireConnection(); const filter = (args?.filter as string) || "all"; const limit = (args?.limit as number) || 20; let records = [...this.commandHistory]; if (filter === "reversible") { records = records.filter((r) => r.reversible && !r.reversed); } else if (filter === "reversed") { records = records.filter((r) => r.reversed); } records = records.slice(-limit); if (records.length === 0) { return { content: [{ type: "text", text: "No hay operaciones en el historial con el filtro aplicado." }], }; } const lines = records.map((r) => { const status = r.reversed ? " [REVERTIDA]" : r.reversible ? " [reversible]" : ""; const params = Object.entries(r.params) .map(([k, v]) => `${k}=${v}`) .join(", "); return `#${r.id} [${r.timestamp}] ${r.tool}(${params})${status}`; }); return { content: [ { type: "text", text: [ `Historial de operaciones (${records.length}/${this.commandHistory.length} total):`, "", ...lines, ].join("\n"), }, ], }; } - src/tools.ts:276-294 (registration)Definition and registration of the ssh_history tool.
name: "ssh_history", description: "Muestra el historial de operaciones ejecutadas durante la conexión activa. Permite filtrar por tipo de operación y limitar resultados", inputSchema: { type: "object", properties: { filter: { type: "string", enum: ["all", "reversible", "reversed"], description: "Filtro del historial: 'all' (todas), 'reversible' (solo reversibles), 'reversed' (solo revertidas). Default: 'all'", }, limit: { type: "number", description: "Número máximo de registros a retornar (default: 20)", }, }, }, },