Skip to main content
Glama
lkb2k

Gradle Tomcat MCP Server

by lkb2k

start_tomcat

Launch Tomcat server using Gradle commands to run web applications from a specified directory.

Instructions

Launch Tomcat via Gradle

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gradle_commandNoGradle command to run (default: appRun)appRun
working_directoryNoWorking directory for the Gradle command

Implementation Reference

  • The core handler function that implements the start_tomcat tool logic: spawns the Gradle process for Tomcat, sets up event emitters for logs and errors, and returns process status.
    async startTomcat(gradleCommand = 'appRun', workingDirectory = null) {
      if (this.process) {
        throw new Error('Tomcat is already running');
      }
    
      const workDir = workingDirectory || this.config.workingDirectory || process.cwd();
      const command = gradleCommand || this.config.gradleCommand || 'appRun';
    
      return new Promise((resolve, reject) => {
        try {
          this.process = spawn('./gradlew', [command], {
            cwd: workDir,
            stdio: ['pipe', 'pipe', 'pipe'],
            detached: false
          });
    
          this.startTime = new Date();
    
          this.process.stdout.on('data', (data) => {
            this.emit('stdout', data.toString());
          });
    
          this.process.stderr.on('data', (data) => {
            this.emit('stderr', data.toString());
          });
    
          this.process.on('error', (error) => {
            this.emit('error', error);
            this.cleanup();
            reject(error);
          });
    
          this.process.on('exit', (code, signal) => {
            this.emit('exit', { code, signal });
            this.cleanup();
          });
    
          setTimeout(() => {
            if (this.process && this.process.pid) {
              resolve({
                running: true,
                pid: this.process.pid,
                uptime: this.getUptime(),
                port: this.config.port || null,
                gradle_command: command
              });
            } else {
              reject(new Error('Failed to start Tomcat process'));
            }
          }, 1000);
    
        } catch (error) {
          reject(error);
        }
      });
    }
  • Input schema defining the parameters for the start_tomcat tool: gradle_command (string, default 'appRun') and working_directory (string).
    inputSchema: {
      type: "object",
      properties: {
        gradle_command: {
          type: "string",
          description: "Gradle command to run (default: appRun)",
          default: "appRun"
        },
        working_directory: {
          type: "string",
          description: "Working directory for the Gradle command"
        }
      }
    }
  • Registration of the start_tomcat tool in the TOOLS array, including name, description, and input schema.
    {
      name: "start_tomcat",
      description: "Launch Tomcat via Gradle",
      inputSchema: {
        type: "object",
        properties: {
          gradle_command: {
            type: "string",
            description: "Gradle command to run (default: appRun)",
            default: "appRun"
          },
          working_directory: {
            type: "string",
            description: "Working directory for the Gradle command"
          }
        }
      }
    },
  • Dispatch helper in the handleToolCall switch statement that maps tool arguments to the startTomcat method call.
    case "start_tomcat":
      return await processManager.startTomcat(
        args.gradle_command,
        args.working_directory
      );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('Launch') but doesn't describe what happens during execution (e.g., whether it blocks until Tomcat is ready, if it runs in background, error handling, or side effects like port binding). This leaves significant gaps for a tool that likely involves system processes.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It's front-loaded with the core action and method, making it easy to scan and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for a tool that likely involves complex system behavior. It doesn't explain what 'Launch' entails operationally (e.g., success criteria, timeouts, or output format), leaving the agent with insufficient context for reliable use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents both parameters (gradle_command and working_directory). The description adds no additional parameter semantics beyond what's in the schema, but the baseline is 3 since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Launch') and target ('Tomcat') with the method ('via Gradle'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from siblings like 'restart_tomcat' or 'get_tomcat_status' in terms of initial startup versus other lifecycle operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'restart_tomcat' or 'stop_tomcat'. It lacks context about prerequisites (e.g., Tomcat must be stopped first) or typical scenarios for launching versus restarting, leaving the agent to infer usage from tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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