Skip to main content
Glama
lkb2k

Gradle Tomcat MCP Server

by lkb2k

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
confirmYesConfirmation required to clear logs

Implementation Reference

  • 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}` }; } }
  • 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"] } }
  • 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();

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lkb2k/mcp-gradle'

If you have feedback or need assistance with the MCP directory API, please join our Discord server