Skip to main content
Glama
lkb2k

Gradle Tomcat MCP Server

by lkb2k

stop_tomcat

Terminate the Tomcat process in Gradle-based applications to stop the server. Use the force option for immediate termination with SIGKILL.

Instructions

Terminate Tomcat process

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
forceNoForce termination with SIGKILL

Implementation Reference

  • Registers the 'stop_tomcat' tool in the TOOLS array, including its name, description, and input schema defining an optional 'force' boolean parameter.
    {
      name: "stop_tomcat",
      description: "Terminate Tomcat process",
      inputSchema: {
        type: "object",
        properties: {
          force: {
            type: "boolean",
            description: "Force termination with SIGKILL",
            default: false
          }
        }
      }
    },
  • Handler dispatch in handleToolCall function that invokes ProcessManager.stopTomcat with the force argument for the stop_tomcat tool.
    case "stop_tomcat":
      return await processManager.stopTomcat(args.force);
  • Core implementation of the stop_tomcat tool logic in ProcessManager class: stops the Tomcat process with SIGTERM (graceful) or SIGKILL (force), with a 10-second timeout fallback to force kill.
    async stopTomcat(force = false) {
      if (!this.process) {
        return { success: true, message: 'Tomcat is not running' };
      }
    
      return new Promise((resolve) => {
        const pid = this.process.pid;
        
        if (force) {
          this.process.kill('SIGKILL');
        } else {
          this.process.kill('SIGTERM');
        }
    
        const timeout = setTimeout(() => {
          if (this.process) {
            this.process.kill('SIGKILL');
          }
          resolve({ success: true, message: `Tomcat process ${pid} forcefully terminated` });
        }, 10000);
    
        this.process.on('exit', () => {
          clearTimeout(timeout);
          resolve({ success: true, message: `Tomcat process ${pid} terminated gracefully` });
        });
      });
    }

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

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