clear_logs
Remove log buffer and files from Gradle Tomcat applications to free disk space and maintain system performance.
Instructions
Clear log buffer and files
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"confirm": "<confirm>"
},
"name": "clear_logs"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | Yes | Confirmation required to clear logs |
Implementation Reference
- src/log-manager.js:108-122 (handler)The clearLogs method of LogManager class that clears the in-memory log buffer and deletes all .log files from the configured log directory.
clearLogs() { this.logBuffer = []; try { const files = fs.readdirSync(this.logDir); for (const file of files) { if (file.endsWith('.log')) { fs.unlinkSync(path.join(this.logDir, file)); } } return { success: true, message: 'Logs cleared successfully' }; } catch (error) { return { success: false, message: `Failed to clear log files: ${error.message}` }; } } - src/tools/index.js:88-102 (schema)JSON schema definition for the clear_logs tool, defining input parameters with a required 'confirm' boolean.
{ name: "clear_logs", description: "Clear log buffer and files", inputSchema: { type: "object", properties: { confirm: { type: "boolean", description: "Confirmation required to clear logs", default: false } }, required: ["confirm"] } } - src/tools/index.js:134-139 (registration)Registration and dispatching logic in the handleToolCall switch statement that checks the 'confirm' parameter and invokes the logManager.clearLogs() handler.
case "clear_logs": if (!args.confirm) { throw new Error("Confirmation required to clear logs. Set confirm=true"); } return logManager.clearLogs();