clear_logs
Clear log buffer and files in Gradle Tomcat MCP Server to free up storage and maintain system performance. Requires confirmation for execution.
Instructions
Clear log buffer and files
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | Yes | Confirmation required to clear logs |
Implementation Reference
- src/log-manager.js:108-122 (handler)The clearLogs method in LogManager that executes the tool logic: clears the in-memory log buffer and deletes all log files in 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:91-101 (schema)Input schema definition for the clear_logs tool, requiring a 'confirm' boolean parameter.inputSchema: { type: "object", properties: { confirm: { type: "boolean", description: "Confirmation required to clear logs", default: false } }, required: ["confirm"] }
- src/tools/index.js:134-139 (registration)Tool call dispatcher registration for 'clear_logs': validates confirmation argument 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();